function hook_comment_insert

Respond to creation of a new comment.

Parameters

Drupal\comment\Comment $comment: The comment object.

Related topics

2 functions implement hook_comment_insert()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entity_crud_hook_test_comment_insert in drupal/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
Implements hook_comment_insert().
search_comment_insert in drupal/core/modules/search/search.module
Implements hook_comment_insert().

File

drupal/core/modules/comment/comment.api.php, line 35
Hooks provided by the Comment module.

Code

function hook_comment_insert(Drupal\comment\Comment $comment) {

  // Reindex the node when comments are added.
  search_touch_node($comment->nid->target_id);
}