menu_node_nodeapi

Versions
menu_node
menu_node_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL)

Implements hook_nodeapi().

Code

./menu_node.module, line 13

<?php
function menu_node_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  $watch = array('insert', 'update', 'delete');

  // Do we care about this node?
  if (!in_array($op, $watch)) {
    return;
  }

  $mlid = (isset($node->menu['mlid'])) ? $node->menu['mlid'] : NULL;
  // If the node is being deleted, remove all records.
  if ($op == 'delete') {
    menu_node_delete($node->nid);
  }
  else {
    // If we have a record to insert, then do so now.
    if (empty($node->menu['delete']) && !empty($mlid)) {
      menu_node_save($node->nid, $mlid);
    }
    // If the menu item is being deleted, do so.
    else if (!empty($mlid)) {
      menu_node_delete($node->nid, $mlid);
    }
  }
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List