diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index 93a54d3..c1cd26a 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -139,7 +139,7 @@ function comment_update_8002() { $entity_type_manager = \Drupal::entityTypeManager(); // Save the comment delete action to config. - $config_install_path = drupal_get_path('module', 'comment') . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY; + $config_install_path = $module_handler->getModule('comment')->getPath() . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY; $storage = new FileStorage($config_install_path); $entity_type_manager ->getStorage('action') @@ -147,7 +147,7 @@ function comment_update_8002() { ->save(); // Save the comment admin view to config. - $optional_install_path = drupal_get_path('module', 'comment') . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY; + $optional_install_path = $module_handler->getModule('comment')->getPath() . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY; $storage = new FileStorage($optional_install_path); $entity_type_manager ->getStorage('view') diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentPermalinkFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentPermalinkFormatter.php index 711835f..931e271 100644 --- a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentPermalinkFormatter.php +++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentPermalinkFormatter.php @@ -13,7 +13,10 @@ use Drupal\Core\Field\Plugin\Field\FieldFormatter\StringFormatter; /** - * Plugin implementation of the 'string' formatter. + * Plugin implementation of the 'comment_permalink' formatter. + * + * All the other entities use 'canonical' or 'revision' links to link the entity + * to itself but comments use permalink URL. * * @FieldFormatter( * id = "comment_permalink", diff --git a/core/modules/comment/src/Tests/Views/CommentAdminTest.php b/core/modules/comment/src/Tests/Views/CommentAdminTest.php index daba92e..2509cb9 100644 --- a/core/modules/comment/src/Tests/Views/CommentAdminTest.php +++ b/core/modules/comment/src/Tests/Views/CommentAdminTest.php @@ -72,7 +72,7 @@ public function testApprovalAdminInterface() { 'comment_body' => $body, 'entity_id' => $this->node->id(), 'entity_type' => 'node', - 'field_name' => 'comment' + 'field_name' => 'comment', ]); $this->drupalLogout(); @@ -136,7 +136,7 @@ public function testApprovalAdminInterface() { $this->drupalLogout(); $node_access_user = $this->drupalCreateUser([ 'administer comments', - 'bypass node access' + 'bypass node access', ]); $this->drupalLogin($node_access_user); $this->drupalGet('admin/content/comment'); diff --git a/core/modules/comment/src/Tests/Views/CommentEditTest.php b/core/modules/comment/src/Tests/Views/CommentEditTest.php new file mode 100644 index 0000000..d9733ed --- /dev/null +++ b/core/modules/comment/src/Tests/Views/CommentEditTest.php @@ -0,0 +1,42 @@ +drupalLogin($this->adminUser); + // Post a comment to node. + $node_comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE); + $this->drupalGet('admin/content/comment'); + $this->assertText($this->adminUser->label()); + $this->drupalGet($node_comment->toUrl('edit-form')->toString()); + $edit = [ + 'comment_body[0][value]' => $this->randomMachineName(), + ]; + $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalGet('admin/content/comment'); + $this->assertText($this->adminUser->label()); + } + +}