You are here

function menu_nodeapi in Drupal 4

Same name and namespace in other branches
  1. 5 modules/menu/menu.module \menu_nodeapi()
  2. 6 modules/menu/menu.module \menu_nodeapi()

Implementation of hook_nodeapi().

File

modules/menu.module, line 136
Allows administrators to customize the site navigation menu.

Code

function menu_nodeapi(&$node, $op) {
  if (user_access('administer menu')) {
    switch ($op) {
      case 'insert':
      case 'update':
        if ($node->menu['delete']) {
          menu_node_form_delete($node);
          menu_rebuild();
        }
        elseif ($node->menu['title']) {
          $node->menu['path'] = $node->menu['path'] ? $node->menu['path'] : "node/{$node->nid}";
          menu_edit_item_save($node->menu);
          menu_rebuild();
        }
        break;
      case 'delete':
        menu_node_form_delete($node);
        menu_rebuild();
        break;
    }
  }
}