diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/AuthorNameFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/AuthorNameFormatter.php index 1d10dd0..6053fda 100644 --- a/core/modules/comment/src/Plugin/Field/FieldFormatter/AuthorNameFormatter.php +++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/AuthorNameFormatter.php @@ -44,6 +44,17 @@ public function viewElements(FieldItemListInterface $items, $langcode) { ); } + if (count($items)==0) { + $comment = $items->getEntity(); + $account = $comment->getOwner(); + $elements[0] = array( + '#theme' => 'username', + '#account' => $account, + '#cache' => array( + 'tags' => $account->getCacheTags() + $comment->getCacheTags(), + ), + ); + } return $elements; }