You are here

function menu_edit_item_submit in Drupal 7

Same name and namespace in other branches
  1. 6 modules/menu/menu.admin.inc \menu_edit_item_submit()

Process menu and menu item add/edit form submissions.

File

modules/menu/menu.admin.inc, line 431
Administrative page callbacks for menu module.

Code

function menu_edit_item_submit($form, &$form_state) {
  $item =& $form_state['values'];

  // The value of "hidden" is the opposite of the value
  // supplied by the "enabled" checkbox.
  $item['hidden'] = (int) (!$item['enabled']);
  unset($item['enabled']);
  $item['options']['attributes']['title'] = $item['description'];
  list($item['menu_name'], $item['plid']) = explode(':', $item['parent']);
  if (!menu_link_save($item)) {
    drupal_set_message(t('There was an error saving the menu link.'), 'error');
  }
  else {
    drupal_set_message(t('Your configuration has been saved.'));
  }
  $form_state['redirect'] = 'admin/structure/menu/manage/' . $item['menu_name'];
}