Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CommentHooks.php

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) : void {
    if (\Drupal::moduleHandler()->moduleExists('history')) {
        $build['#attributes']['data-history-node-id'] = $node->id();
    }
}
RSS feed
Powered by Drupal