From 8e7aa28a7c6e1b1401301d859a9ffdbb27328373 Mon Sep 17 00:00:00 2001 From: Gerhard Killesreiter Date: Tue, 14 Apr 2020 17:13:49 +0200 Subject: [PATCH] INREL-7474: catch one more error condition --- modules/infinite_media/src/MediaHelper.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) {