Browse Source

Update UrlExtractor.php

3.1.x
JeroenT 4 years ago
parent
commit
7eb023dd00
  1. 5
      src/UrlExtractor.php

5
src/UrlExtractor.php

@ -51,11 +51,12 @@ class UrlExtractor {
return $this->getUrlFromEntity($input, $relative); return $this->getUrlFromEntity($input, $relative);
} }
elseif ($input instanceof EntityReferenceFieldItemListInterface) { elseif ($input instanceof EntityReferenceFieldItemListInterface) {
if ($item = $input->first()) { $item = $input->first();
if (!empty($item) && $input->entity instanceof ContentEntityInterface) {
return $this->getUrlFromEntity($item->entity, $relative); return $this->getUrlFromEntity($item->entity, $relative);
} }
} }
elseif ($input instanceof EntityReferenceItem) { elseif ($input instanceof EntityReferenceItem && $input->entity instanceof ContentEntityInterface) {
return $this->getUrlFromEntity($input->entity, $relative); return $this->getUrlFromEntity($input->entity, $relative);
} }
elseif ($input instanceof LinkItemInterface) { elseif ($input instanceof LinkItemInterface) {

Loading…
Cancel
Save