You are here

function menu_nodeapi in Drupal 5

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

Implementation of hook_nodeapi().

File

modules/menu/menu.module, line 138
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;
    }
  }
}