You are here

function menu_position_rule_form_validate in Menu Position 6

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

Validates the form for menu_position_rule_form().

1 string reference to 'menu_position_rule_form_validate'
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 434
Provides infrequently used functions and hooks for menu_position.

Code

function menu_position_rule_form_validate($form, &$form_state) {

  // Check if the user cancelled the form.
  if (!empty($form['cancel']) && $form_state['values']['op'] == $form['cancel']['#value']) {
    drupal_goto('admin/build/menu-position');
    return;
  }

  // Check if the user deleted the rule.
  if (!empty($form['delete']) && $form_state['values']['op'] == $form['delete']['#value']) {
    drupal_goto('admin/build/menu-position/delete/' . $form_state['values']['rid']);
    return;
  }

  // Don't allow the user to select a menu name instead of a menu item.
  list($menu_name, $plid) = explode(':', $form_state['values']['plid']);
  if ($plid == 0) {
    form_set_error('plid', t('Please select a menu item. You have selected the name of a menu.'));
  }
}