menu_edit_item_save

Definition

menu_edit_item_save($edit)
menu/menu.module, line 521

Description

Save changes to a menu item into the database.

Return value

mid

Code

<?php
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'];
}
?>