function node_example_delete in Examples for Developers 6
Implementation of hook_delete().
When a node is deleted, we need to remove all related records from our table.
Related topics
File
- node_example/
node_example.module, line 252 - This is an example outlining how a module can be used to define a new node type.
Code
function node_example_delete($node) {
// Notice that we're matching all revision, by using the node's nid.
db_query('DELETE FROM {node_example} WHERE nid = %d', $node->nid);
}