function hook_comment_delete

Respond to comment deletion.

This hook is invoked from comment_delete_multiple() after field_attach_delete() has called and after the comment has been removed from the database.

Parameters

Drupal\comment\Comment $comment: The comment object for the comment that has been deleted.

See also

hook_comment_predelete()

comment_delete_multiple()

entity_delete_multiple()

Related topics

4 functions implement hook_comment_delete()

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_delete in drupal/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
Implements hook_comment_delete().
forum_comment_delete in drupal/core/modules/forum/forum.module
Implements hook_comment_delete().
search_comment_delete in drupal/core/modules/search/search.module
Implements hook_comment_delete().
tracker_comment_delete in drupal/core/modules/tracker/tracker.module
Implements hook_comment_delete().

File

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

Code

function hook_comment_delete(Drupal\comment\Comment $comment) {
  drupal_set_message(t('Comment: @subject has been deleted', array(
    '@subject' => $comment->subject,
  )));
}