From 247a438f803e41f3cb49fa40a688bd1c518193f0 Mon Sep 17 00:00:00 2001 From: dannylamb Date: Fri, 22 Jun 2018 15:43:40 -0300 Subject: [PATCH] Fixing WSOD when term has no uri (#88) --- src/EventSubscriber/LinkHeaderSubscriber.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EventSubscriber/LinkHeaderSubscriber.php b/src/EventSubscriber/LinkHeaderSubscriber.php index 6bec7f8c..3ff64d4b 100644 --- a/src/EventSubscriber/LinkHeaderSubscriber.php +++ b/src/EventSubscriber/LinkHeaderSubscriber.php @@ -203,9 +203,9 @@ abstract class LinkHeaderSubscriber implements EventSubscriberInterface { $rel = "tag"; $entity_url = $referencedEntity->url('canonical', ['absolute' => TRUE]); if ($referencedEntity->hasField('field_external_uri')) { - $external_uri = $referencedEntity->get('field_external_uri')->first()->getValue()['uri']; - if (!empty($external_uri)) { - $entity_url = $external_uri; + $external_uri = $referencedEntity->get('field_external_uri')->getValue(); + if (!empty($external_uri) && isset($external_uri[0]['uri'])) { + $entity_url = $external_uri[0]['uri']; } } $title = $referencedEntity->label();