1 nodeapi_example.module nodeapi_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/nodeapi_example/nodeapi_example.module, line 186
Module implementation for nodeapi_example module.

Code

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