function menu_position_rule_form_submit in Menu Position 7
Same name and namespace in other branches
- 6 menu_position.admin.inc \menu_position_rule_form_submit()
- 7.2 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 483 - 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' => isset($form_state['values']['conditions']) ? $form_state['values']['conditions'] : array(),
'menu_name' => $menu_name,
'plid' => $plid,
'machine_name' => $form_state['values']['machine_name'],
);
// 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/structure/menu-position';
}