function comment_node_view_alter

Same name in other branches
  1. 9 core/modules/comment/comment.module \comment_node_view_alter()
  2. 8.9.x core/modules/comment/comment.module \comment_node_view_alter()
  3. 10 core/modules/comment/comment.module \comment_node_view_alter()

Implements hook_ENTITY_TYPE_view_alter() for node entities.

File

core/modules/comment/comment.module, line 226

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();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.