function comment_node_view_alter

comment_node_view_alter(array &$build, EntityInterface $node, EntityViewDisplayInterface $display)

Implements hook_ENTITY_TYPE_view_alter() for node entities.

File

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

Code

function comment_node_view_alter(array &$build, EntityInterface $node, EntityViewDisplayInterface $display) {
  if (\Drupal::moduleHandler()->moduleExists('history')) {
    $build['#attributes']['data-history-node-id'] = $node->id();
  }
}

© 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_view_alter/8.1.x