Same name and namespace in other branches
  1. 8.9.x core/modules/comment/src/Entity/Comment.php \Drupal\comment\Entity\Comment::permalink()
  2. 9 core/modules/comment/src/Entity/Comment.php \Drupal\comment\Entity\Comment::permalink()

Returns the permalink URL for this comment.

Return value

\Drupal\Core\Url

Overrides CommentInterface::permalink

File

core/modules/comment/src/Entity/Comment.php, line 215

Class

Comment
Defines the comment entity class.

Namespace

Drupal\comment\Entity

Code

public function permalink() {
  $uri = $this
    ->toUrl();
  $uri
    ->setOption('fragment', 'comment-' . $this
    ->id());
  return $uri;
}