comment_node_links_alter

comment_node_links_alter(array &$links, NodeInterface $node, array &$context)

Implements hook_node_links_alter().

File

core/modules/comment/comment.module, line 198
Enables users to comment on published content.

Code

1
2
3
4
5
6
7
8
9
10
function comment_node_links_alter(array &$links, NodeInterface $node, array &$context) {
  // Comment links are only added to node entity type for backwards
  // compatibility. Should you require comment links for other entity types you
  // can do so by implementing a new field formatter.
  // @todo Make this configurable from the formatter. See
 
  $comment_links = \Drupal::service('comment.link_builder')->buildCommentedEntityLinks($node, $context);
  $links += $comment_links;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.