From 1f9920ceec293effacb696735dbec796d5b4f595 Mon Sep 17 00:00:00 2001 From: Eric Bremner <ebremner@uwaterloo.ca> Date: Thu, 8 Sep 2022 15:32:38 -0400 Subject: [PATCH] ISTWCMS-5709: fixing undefined value error --- src/Service/UwNodeFieldValue.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Service/UwNodeFieldValue.php b/src/Service/UwNodeFieldValue.php index 21c749c1..0a9e12e0 100644 --- a/src/Service/UwNodeFieldValue.php +++ b/src/Service/UwNodeFieldValue.php @@ -650,13 +650,9 @@ class UwNodeFieldValue { */ public function getAuthor(Node $node): array { - // Get the author field from the node, if there is - // no author specified the value will be NULL. - $author_name = $node->field_author->value; - // If there is no author in the field, get the owner // of the blog post. - if (!$author_name) { + if (!$node->field_author) { // Set the author to the person who made blog. $author = [ @@ -670,7 +666,8 @@ class UwNodeFieldValue { // Get the link field from the node. $link = $node->field_uw_author_link->getValue(); - $author['name'] = $author_name; + // Get the auther name from the node. + $author['name'] = $node->field_author->value; if (!empty($link)) { $author['link'] = $link[0]['uri']; -- GitLab