You are here

function menu_position_rule_form_submit in Menu Position 6

Same name and namespace in other branches
  1. 7.2 menu_position.admin.inc \menu_position_rule_form_submit()
  2. 7 menu_position.admin.inc \menu_position_rule_form_submit()

Handles form submission for menu_position_rule_form().

1 string reference to 'menu_position_rule_form_submit'
menu_position_rule_form in ./menu_position.admin.inc
Returns form to add or edit a menu position rule.

File

./menu_position.admin.inc, line 455
Provides infrequently used functions and hooks for menu_position.

Code

function menu_position_rule_form_submit($form, &$form_state) {
  list($menu_name, $plid) = explode(':', $form_state['values']['plid']);
  $rule = array(
    'admin_title' => $form_state['values']['admin_title'],
    'conditions' => serialize($form_state['values']['conditions']),
    'menu_name' => $menu_name,
    'plid' => $plid,
  );

  // Add the rule to the database.
  if ($form_state['values']['rid'] == '') {
    menu_position_add_rule($rule);
    drupal_set_message(t('Rule has been added.'));
  }
  else {
    $rule['rid'] = $form_state['values']['rid'];
    menu_position_edit_rule($rule);
    drupal_set_message(t('Rule has been modified.'));
  }
  $form_state['redirect'] = 'admin/build/menu-position';
}