1 node_hooks_example.module node_hooks_example_node_delete($node)

Implements hook_node_delete().

When a node is deleted, we need to remove all related records from our table, including all revisions. For the delete operations we use node->nid.

Related topics

File

modules/examples/node_hooks_example/node_hooks_example.module, line 169
Hook implementations for the Node Hooks Example module.

Code

function node_hooks_example_node_delete($node) {
  // Notice that we're deleting even if the content type has no rating enabled.
  db_delete('node_hooks_example')
    ->condition('nid', $node->nid)
    ->execute();
}