From c68ffbc797258f763af8da5ee466ef3c38b1eda7 Mon Sep 17 00:00:00 2001
From: Eric Bremner <ebremner@uwaterloo.ca>
Date: Fri, 12 Nov 2021 23:31:51 +0000
Subject: [PATCH] ISTWCMS-5195: fixing author on get node data

---
 src/Service/UwNodeFieldValue.php | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/Service/UwNodeFieldValue.php b/src/Service/UwNodeFieldValue.php
index d04d272f..6905ed93 100644
--- a/src/Service/UwNodeFieldValue.php
+++ b/src/Service/UwNodeFieldValue.php
@@ -383,7 +383,6 @@ class UwNodeFieldValue {
       // Set the author to the person who made blog.
       $author = [
         'name' => $node->getOwner()->getDisplayName(),
-        'link' => NULL,
       ];
     }
 
@@ -393,11 +392,11 @@ class UwNodeFieldValue {
       // Get the link field from the node.
       $link = $node->field_uw_author_link->getValue();
 
-      // Set the author name and link (if any).
-      $author = [
-        'name' => $author_name,
-        'link' => empty($link) ? NULL : $link[0]['uri'],
-      ];
+      $author['name'] = $author_name;
+
+      if (!empty($link)) {
+        $author['link'] = $link[0]['uri'];
+      }
     }
 
     return $author;
-- 
GitLab