Skip to content
Snippets Groups Projects
Commit 1f9920ce authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-5709: fixing undefined value error

parent b819bab2
No related branches found
No related tags found
1 merge request!264ISTWCMS-5709: removing the author from the teaser for news and blog
...@@ -650,13 +650,9 @@ class UwNodeFieldValue { ...@@ -650,13 +650,9 @@ class UwNodeFieldValue {
*/ */
public function getAuthor(Node $node): array { 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 // If there is no author in the field, get the owner
// of the blog post. // of the blog post.
if (!$author_name) { if (!$node->field_author) {
// Set the author to the person who made blog. // Set the author to the person who made blog.
$author = [ $author = [
...@@ -670,7 +666,8 @@ class UwNodeFieldValue { ...@@ -670,7 +666,8 @@ class UwNodeFieldValue {
// Get the link field from the node. // Get the link field from the node.
$link = $node->field_uw_author_link->getValue(); $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)) { if (!empty($link)) {
$author['link'] = $link[0]['uri']; $author['link'] = $link[0]['uri'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment