function hook_node_delete

7.x node.api.php hook_node_delete($node)

Respond to node deletion.

This hook is invoked from node_delete_multiple() after the type-specific hook_delete() has been invoked, but before hook_entity_delete and field_attach_delete() are called, and before the node is removed from the node table in the database.

Parameters

$node: The node that is being deleted.

Related topics

12 functions implement hook_node_delete()

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

book_node_delete in drupal-7.x/modules/book/book.module
Implements hook_node_delete().
comment_node_delete in drupal-7.x/modules/comment/comment.module
Implements hook_node_delete().
entity_crud_hook_test_node_delete in drupal-7.x/modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_node_delete().
forum_node_delete in drupal-7.x/modules/forum/forum.module
Implements hook_node_delete().
menu_node_delete in drupal-7.x/modules/menu/menu.module
Implements hook_node_delete().

... See full list

4 invocations of hook_node_delete()
field_attach_delete in drupal-7.x/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 drupal-7.x/modules/field/field.crud.inc
Purges the field data for a single field on a single pseudo-entity.
node_delete_multiple in drupal-7.x/modules/node/node.module
Deletes multiple nodes.
node_delete_multiple in drupal-7.x/modules/node/node.module
Deletes multiple nodes.

File

drupal-7.x/modules/node/node.api.php, line 472
Hooks provided by the Node module.

Code

function hook_node_delete($node) {
  db_delete('mytable')
    ->condition('nid', $node->nid)
    ->execute();
}