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 237
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();
  }
}
doc_Drupal
2016-10-29 08:51:29
Comments
Leave a Comment

Please login to continue.