diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php index ac61f07..3a91ad6 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php @@ -168,9 +168,6 @@ protected function viewValue(FieldItemInterface $item) { * The URI elements of the entity. */ protected function getEntityUrl(EntityInterface $entity) { - if (class_exists('Drupal\comment\Entity\Comment') && $entity instanceof \Drupal\comment\CommentInterface) { - return $entity->permalink(); - } // For the default revision this falls back to 'canonical' return $entity->urlInfo('revision'); } diff --git a/core/modules/comment/config/optional/views.view.comment.yml b/core/modules/comment/config/optional/views.view.comment.yml index b5b65fd..56c4de3 100644 --- a/core/modules/comment/config/optional/views.view.comment.yml +++ b/core/modules/comment/config/optional/views.view.comment.yml @@ -232,7 +232,7 @@ display: empty_zero: false hide_alter_empty: true click_sort_column: value - type: string + type: comment_permalink settings: link_to_entity: true group_column: value @@ -748,7 +748,7 @@ display: empty_zero: false hide_alter_empty: true click_sort_column: value - type: string + type: comment_permalink settings: link_to_entity: true group_column: value diff --git a/core/modules/comment/src/CommentViewsData.php b/core/modules/comment/src/CommentViewsData.php index 49bbbd4..91c97a3 100644 --- a/core/modules/comment/src/CommentViewsData.php +++ b/core/modules/comment/src/CommentViewsData.php @@ -27,6 +27,7 @@ public function getViewsData() { $data['comment_field_data']['subject']['title'] = t('Title'); $data['comment_field_data']['subject']['help'] = t('The title of the comment.'); + $data['comment_field_data']['subject']['field']['default_formatter'] = 'comment_permalink'; $data['comment_field_data']['name']['title'] = t('Author'); $data['comment_field_data']['name']['help'] = t("The name of the comment's author. Can be rendered as a link to the author's homepage."); diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentPermalinkFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentPermalinkFormatter.php new file mode 100644 index 0000000..5e22475 --- /dev/null +++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentPermalinkFormatter.php @@ -0,0 +1,46 @@ +permalink(); + } + + /** + * {@inheritdoc} + */ + public static function isApplicable(FieldDefinitionInterface $field_definition) { + return parent::isApplicable($field_definition) && $field_definition->getName() === 'subject'; + } + +} diff --git a/core/modules/comment/src/Plugin/views/field/CommentBulkForm.php b/core/modules/comment/src/Plugin/views/field/CommentBulkForm.php index e4b691f..f1a6d43 100644 --- a/core/modules/comment/src/Plugin/views/field/CommentBulkForm.php +++ b/core/modules/comment/src/Plugin/views/field/CommentBulkForm.php @@ -20,7 +20,7 @@ class CommentBulkForm extends BulkForm { * {@inheritdoc} */ protected function emptySelectedMessage() { - return $this->t('No comments selected.'); + return $this->t('Select one or more comments to perform the update on.'); } } diff --git a/core/modules/comment/src/Tests/Views/CommentAdminTest.php b/core/modules/comment/src/Tests/Views/CommentAdminTest.php index 1946688..cb2a29a 100644 --- a/core/modules/comment/src/Tests/Views/CommentAdminTest.php +++ b/core/modules/comment/src/Tests/Views/CommentAdminTest.php @@ -96,7 +96,7 @@ function testApprovalAdminInterface() { // Test message when no comments selected. $this->drupalPostForm('admin/content/comment', [], t('Apply')); - $this->assertText(t('No comments selected.')); + $this->assertText(t('Select one or more comments to perform the update on.')); // Delete multiple comments in one operation. $edit = array( 'action' => 'comment_delete_action',