Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

INREL-7474: catch one more error condition #167

Open
wants to merge 1 commit into
base: 8.x-2.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/infinite_media/src/MediaHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down