function CommentHooks::nodeViewAlter

Implements hook_ENTITY_TYPE_view_alter() for node entities.

File

core/modules/comment/src/Hook/CommentHooks.php, line 215

Class

CommentHooks
Hook implementations for comment.

Namespace

Drupal\comment\Hook

Code

public function nodeViewAlter(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.