public function renderLinks($comment_entity_id,
$view_mode,
$langcode,
$is_in_preview) { $links =
[ '#theme' => 'links__comment',
'#pre_render' =>
[[Link::
class, 'preRenderLinks'
]],
'#attributes' =>
['class' =>
['links', 'inline'
]],
];
if (!
$is_in_preview) { /** @var \Drupal\comment\CommentInterface $entity */
$entity =
$this->entityTypeManager->
getStorage('comment'
)->
load($comment_entity_id);
if ($commented_entity =
$entity->
getCommentedEntity()) { $links['comment'
] =
$this->
buildLinks($entity,
$commented_entity);
} // Allow other modules to alter the comment links.
$hook_context =
[ 'view_mode' =>
$view_mode,
'langcode' =>
$langcode,
'commented_entity' =>
$commented_entity,
];
$this->moduleHandler->
alter('comment_links',
$links,
$entity,
$hook_context);
} return $links;
}