node_example_nodeapi

  1. drupal
    1. 4.7 node_example.module
    2. 5 node_example.module
    3. 6
Versions
4.7 – 6 node_example_nodeapi(&$node, $op, $teaser, $page)

Implementation of hook_nodeapi().

When a node revision is deleted, we need to remove the corresponding record from our table. The only way to handle revision deletion is by implementing hook_nodeapi().

Related topics

Code

examples/node_example/node_example.module, line 239

<?php
function node_example_nodeapi(&$node, $op, $teaser, $page) {
  switch ($op) {
    case 'delete revision':
      // Notice that we're matching a single revision based on the node's vid.
      db_query('DELETE FROM {node_example} WHERE vid = %d', $node->vid);
      break;
  }
}
?>