Skip to content

Commit

Permalink
Fixed compatibility for getImageObject with Contao 4.8 (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
qzminski authored and ausi committed Dec 12, 2019
1 parent 2072a90 commit f848650
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Element/CustomElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace MadeYourDay\RockSolidCustomElements\Element;

use Contao\Image\PictureConfiguration;
use Contao\Image\PictureConfigurationInterface;
use Contao\ModuleModel;
use MadeYourDay\RockSolidColumns\Element\ColumnsStart;
Expand Down Expand Up @@ -200,12 +201,12 @@ protected function deserializeDataRecursive($data)
/**
* Get an image object from id/uuid and an optional size configuration
*
* @param int|string $id ID, UUID string or binary
* @param string|array|PictureConfigurationInterface $size [width, height, mode] optionally serialized or a config object
* @param int $maxSize Gets passed to addImageToTemplate as $intMaxWidth
* @param string $lightboxId Gets passed to addImageToTemplate as $strLightboxId
* @param array $item Gets merged and passed to addImageToTemplate as $arrItem
* @return object Image object (similar as addImageToTemplate)
* @param int|string $id ID, UUID string or binary
* @param string|array|PictureConfiguration $size [width, height, mode] optionally serialized or a config object
* @param int $maxSize Gets passed to addImageToTemplate as $intMaxWidth
* @param string $lightboxId Gets passed to addImageToTemplate as $strLightboxId
* @param array $item Gets merged and passed to addImageToTemplate as $arrItem
* @return object Image object (similar as addImageToTemplate)
*/
public function getImageObject($id, $size = null, $maxSize = null, $lightboxId = null, $item = array())
{
Expand Down Expand Up @@ -236,7 +237,7 @@ public function getImageObject($id, $size = null, $maxSize = null, $lightboxId =
return null;
}

if (!$size instanceof PictureConfigurationInterface) {
if (!$size instanceof PictureConfiguration && !$size instanceof PictureConfigurationInterface) {
if (is_string($size) && trim($size)) {
$size = \StringUtil::deserialize($size);
}
Expand Down

0 comments on commit f848650

Please sign in to comment.