Skip to content
This repository was archived by the owner on Jun 22, 2020. It is now read-only.

Commit

Permalink
#2883612 Fix PHP notice when trying to change the format for the auth…
Browse files Browse the repository at this point in the history
…or name.
  • Loading branch information
Maximilian Haupt authored and dbosen committed Jun 7, 2017
1 parent b23caa4 commit d759081
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ function thunder_fia_preprocess_views_view_row_fia(&$variables) {

// Change author name to "firstname lastname".
$owner = $node->getOwner();
$variables['options']['author'] = [
'#markup' => '<a>' . $owner->first_name->value . ' ' . $owner->last_name->value . '</a>',
];
if (isset($owner->first_name, $owner->last_name)) {
$name = $owner->first_name->value . ' ' . $owner->last_name->value;
if ($name = trim($name) && !empty($variables['options']['author'])) {
$variables['options']['author'] = ['#markup' => '<a>' . $name . '</a>'];
}
}
}
}

Expand Down

0 comments on commit d759081

Please sign in to comment.