1 node.api.php hook_node_predelete(Node $node)

Act before node deletion.

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

Parameters

Node $node: The node that is about to be deleted.

See also

hook_node_predelete()

node_delete_multiple()

Related topics

File

core/modules/node/node.api.php, line 409
Hooks provided by the Node module.

Code

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