function NodeSearchHooks::commentUpdate

Same name and namespace in other branches
  1. 11.x core/modules/node/src/Hook/NodeSearchHooks.php \Drupal\node\Hook\NodeSearchHooks::commentUpdate()

Implements hook_ENTITY_TYPE_update() for comment entities.

Attributes

#[Hook('comment_update')]

File

core/modules/node/src/Hook/NodeSearchHooks.php, line 112

Class

NodeSearchHooks
Search related hook implementations for node module.

Namespace

Drupal\node\Hook

Code

public function commentUpdate($comment) : void {
  // Reindex the node when comments are changed.
  if ($comment->getCommentedEntityTypeId() == 'node') {
    $this->reindexNodeForSearch($comment->getCommentedEntityId());
  }
}

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