diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 874fbe3..2591b61 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -656,11 +656,10 @@ function template_preprocess_comment(&$variables) { $variables['permalink'] = \Drupal::l(t('Permalink'), new Url('')); } else { - $uri = $comment->urlInfo(); + $uri = $comment->permalink(); $attributes = $uri->getOption('attributes') ?: array(); $attributes += array('class' => array('permalink'), 'rel' => 'bookmark'); $uri->setOption('attributes', $attributes); - $uri->setOption('fragment', 'comment-' . $comment->id()); $variables['title'] = \Drupal::l($comment->getSubject(), $uri); $variables['permalink'] = \Drupal::l(t('Permalink'), $comment->permalink()); diff --git a/core/modules/comment/src/Tests/CommentTitleTest.php b/core/modules/comment/src/Tests/CommentTitleTest.php index 9f9b4ef..103845a 100644 --- a/core/modules/comment/src/Tests/CommentTitleTest.php +++ b/core/modules/comment/src/Tests/CommentTitleTest.php @@ -64,9 +64,9 @@ public function testCommentPopulatedTitles() { $this->assertTrue($this->commentExists($comment1), 'Comment #1. Comment found.'); // Tests that markup is created for comment with heading. $this->assertPattern('|]*>]*>' . $subject_text . '|', 'Comment title is rendered in h3 when title populated.'); - // Tests that the comment's title has the correct link. + // Tests that the comment's title link is the permalink of the comment. $comment_permalink = $this->cssSelect('.permalink'); $comment_permalink = (string) $comment_permalink[0]['href']; - $this->assertEqual(base_path() . 'comment/' . $comment1->id() . '#comment-' . $comment1->id(), $comment_permalink, 'The comment\'s title has the correct link'); + $this->assertEqual($comment1->permalink()->toString(), $comment_permalink, 'The comment\'s title has the correct link'); } }