function NodeSearchHooks::commentInsert
Implements hook_ENTITY_TYPE_insert() for comment entities.
Attributes
#[Hook('comment_insert')]
File
-
core/
modules/ node/ src/ Hook/ NodeSearchHooks.php, line 30
Class
- NodeSearchHooks
- Hook implementations for node entity operations.
Namespace
Drupal\node\HookCode
public function commentInsert($comment) : void {
// Reindex the node when comments are added.
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.