hook_delete

Versions
4.6 – 6
hook_delete(&$node)
7
hook_delete(stdClass $node)

Respond to node deletion.

This is a hook used by node modules. It is called to allow the module to take action when a node is being deleted from the database by, for example, deleting information from related tables.

To take action when nodes of any type are deleted (not just nodes of the type defined by this module), use hook_node() instead.

For a detailed usage example, see node_example.module.

Parameters

$node The node being deleted.

Related topics

Code

modules/node/node.api.php, line 742

<?php
function hook_delete(stdClass $node) {
  db_delete('mytable')
    ->condition('nid', $nid->nid)
    ->execute();
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.