On this page
function 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 197
- Enables users to comment on published content.
Code
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
// https://www.drupal.org/node/1901110.
$comment_links = \Drupal::service('comment.link_builder')->buildCommentedEntityLinks($node, $context);
$links += $comment_links;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!comment!comment.module/function/comment_node_links_alter/8.1.x