You are here

function menu_edit_item_save in Drupal 5

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

Save changes to a menu item into the database.

Return value

mid

2 calls to menu_edit_item_save()
menu_edit_item_form_submit in modules/menu/menu.module
Process menu and menu item add/edit form submissions.
menu_nodeapi in modules/menu/menu.module
Implementation of hook_nodeapi().

File

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

Code

function menu_edit_item_save($edit) {
  if (isset($edit['expanded'])) {
    if ($edit['expanded']) {
      $edit['type'] |= MENU_EXPANDED;
    }
    else {
      $edit['type'] &= ~MENU_EXPANDED;
    }
  }
  $edit['type'] = $edit['type'] | MENU_MODIFIED_BY_ADMIN;
  $status = menu_save_item($edit);
  $t_args = array(
    '%title' => $edit['title'],
  );
  if ($status == SAVED_UPDATED) {
    drupal_set_message(t('The menu item %title has been updated.', $t_args));
  }
  elseif ($status == SAVED_NEW) {
    drupal_set_message(t('The menu item %title has been added.', $t_args));
    watchdog('menu', t('Added menu item %title.', $t_args), WATCHDOG_NOTICE, l(t('view'), 'admin/build/menu'));
  }
  return $edit['mid'];
}