diff --git a/src/Service/UwNodeFieldValue.php b/src/Service/UwNodeFieldValue.php index 21c749c19db2ab66d2b795c2153666d33c5909f2..0a9e12e091c1587d3575e48bc1998fbfa8e1d6f4 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'];