diff --git a/modules/infinite_media/src/MediaHelper.php b/modules/infinite_media/src/MediaHelper.php index 722295b..45a2aff 100644 --- a/modules/infinite_media/src/MediaHelper.php +++ b/modules/infinite_media/src/MediaHelper.php @@ -4,6 +4,7 @@ use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Url; +use Drupal\file\Entity\File; use Drupal\image\Entity\ImageStyle; class MediaHelper { @@ -25,7 +26,8 @@ public static function getImageUrlFromMediaReference( if ($entity->hasField($fieldName) && !empty($entity->get($fieldName)->entity) && // todo: check why some media entity reference seems to be empty here after isEmpty() check? example: node 6001 $entity->get($fieldName)->entity->hasField($imageFieldName) && - !$entity->get($fieldName)->entity->field_image->isEmpty() + !$entity->get($fieldName)->entity->field_image->isEmpty() && + $entity->get($fieldName)->entity->field_image->entity instanceof File ) { if ($imageStyle) {