diff --git a/core/modules/comment/config/schema/comment.views.schema.yml b/core/modules/comment/config/schema/comment.views.schema.yml index 13e7cf1..cdb22cf 100644 --- a/core/modules/comment/config/schema/comment.views.schema.yml +++ b/core/modules/comment/config/schema/comment.views.schema.yml @@ -78,11 +78,6 @@ views.field.comment_ces_last_updated: type: views_field label: 'Newer of last comment / node updated' -views.field.comment_username: - type: views_field - label: 'Node comment status' - mapping: - views.filter.node_comment: type: views.filter.in_operator label: 'Comment node status' diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/AuthorNameFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/AuthorNameFormatter.php index 2d70f7f..a74628f 100644 --- a/core/modules/comment/src/Plugin/Field/FieldFormatter/AuthorNameFormatter.php +++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/AuthorNameFormatter.php @@ -18,7 +18,7 @@ * label = @Translation("Author name"), * description = @Translation("Display the author name."), * field_types = { - * "comment" + * "string" * } * ) */ @@ -31,10 +31,14 @@ public function viewElements(FieldItemListInterface $items) { $elements = array(); foreach ($items as $delta => $item) { - $account = entity_create('user'); - $account->uid = $item->getOwnerId(); - $account->name = $item->getAuthorName(); - $account->homepage = $item->getHomepage(); + /** @var $comment \Drupal\comment\CommentInterface */ + $comment = $item->getEntity(); + $account = $comment->getOwner(); + if ($account->isAnonymous()) { + $account->setUsername($comment->getAuthorName()); + $account->setEmail($comment->getAuthorEmail()); + $account->homepage = $comment->getHomepage(); + } $elements[$delta] = array( '#theme' => 'username', '#account' => $account, @@ -43,4 +47,4 @@ public function viewElements(FieldItemListInterface $items) { return $elements; } -} \ No newline at end of file +}