function hook_entity_delete

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 system.api.php hook_entity_delete($entity, $type)
cle7 system.api.php hook_entity_delete($entity, $type)
elmsmedia7 system.api.php hook_entity_delete($entity, $type)
icor7 system.api.php hook_entity_delete($entity, $type)
meedjum_blog7 system.api.php hook_entity_delete($entity, $type)
mooc7 system.api.php hook_entity_delete($entity, $type)

Act on entities when deleted.

Parameters

$entity: The entity object.

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

Related topics

9 functions implement 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.

display_cache_entity_delete in sites/all/modules/ulmus/display_cache/display_cache.module
Implements hook_entity_delete().
entitycache_entity_delete in sites/all/modules/ulmus/entitycache/entitycache.module
Implements hook_entity_delete().
entityreference_entity_delete in sites/all/modules/ulmus/entityreference/entityreference.module
Implements hook_entity_delete().
entity_crud_hook_test_entity_delete in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_entity_delete().
entity_test_entity_delete in sites/all/modules/ulmus/entity/tests/entity_test.module
Implements hook_entity_delete().

... See full list

16 invocations of hook_entity_delete()
comment_delete_multiple in modules/comment/comment.module
Delete comments and all their replies.
EntityAPIController::delete in sites/all/modules/ulmus/entity/includes/entity.controller.inc
Implements EntityAPIControllerInterface.
field_attach_delete in modules/field/field.attach.inc
Delete field data for an existing entity. This deletes all revisions of field data for the entity.
field_purge_data in modules/field/field.crud.inc
Purges the field data for a single field on a single pseudo-entity.
file_delete in includes/file.inc
Deletes a file and its database record.

... See full list

File

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

Code

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();
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.