function hook_entity_delete

Act on entities when deleted.


$entity: The entity object.

$type: The type of entity being deleted (i.e. node, user, comment).

Related topics

1 function implements hook_entity_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_entity_delete in drupal/modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_entity_delete().
6 invocations of hook_entity_delete()
comment_delete_multiple in drupal/modules/comment/comment.module
Delete comments and all their replies.
file_delete in drupal/includes/
Deletes a file and its database record.
node_delete_multiple in drupal/modules/node/node.module
Deletes multiple nodes.
taxonomy_term_delete in drupal/modules/taxonomy/taxonomy.module
Delete a term.
taxonomy_vocabulary_delete in drupal/modules/taxonomy/taxonomy.module
Deletes a vocabulary.

... See full list


drupal/modules/system/system.api.php, line 371
Hooks provided by Drupal core and the System module.


function hook_entity_delete($entity, $type) {

  // Delete the entity's entry from a fictional table of all entities.
  $info = entity_get_info($type);
  list($id) = entity_extract_ids($type, $entity);
    ->condition('type', $type)
    ->condition('id', $id)