function NodeSearchHooks::commentDelete

Implements hook_ENTITY_TYPE_delete() for comment entities.

Attributes

#[Hook('comment_delete')]

File

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

Class

NodeSearchHooks
Hook implementations for node entity operations.

Namespace

Drupal\node\Hook

Code

public function commentDelete($comment) : void {
  // Reindex the node when comments are deleted.
  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.