7.x system.api.php | hook_entity_delete($entity, $type) |
Act on entities when deleted.
$entity: The entity object.
$type: The type of entity being deleted (i.e. node, user, comment).
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
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);
db_delete('example_entity')->condition('type', $type)->condition('id', $id)->execute();
}