You are here

function menu_badges_menu_edit_item_submit in Menu Badges 7

Same name and namespace in other branches
  1. 8 menu_badges.module \menu_badges_menu_edit_item_submit()

Submit handler for saving menu badge options.

1 string reference to 'menu_badges_menu_edit_item_submit'
menu_badges_form_menu_edit_item_alter in ./menu_badges.module
Implements hook_form_BASE_FORM_ID_alter().

File

./menu_badges.module, line 119
Menu Badges module file.

Code

function menu_badges_menu_edit_item_submit(&$form, &$form_state) {
  if ($form_state['values']['op'] == $form_state['values']['submit']) {
    if (empty($form_state['values']['menu_badges_callback'])) {
      unset($form_state['values']['options']['link_badge']);
    }
    else {
      $badges = menu_badges_get_badges();
      $form_state['values']['options']['link_badge']['callback'] = $badges[$form_state['values']['menu_badges_callback']]['callback'];
      if (!empty($badges[$form_state['values']['menu_badges_callback']]['arguments'])) {
        $form_state['values']['options']['link_badge']['arguments'] = $badges[$form_state['values']['menu_badges_callback']]['arguments'];
      }
      $form_state['values']['options']['link_badge']['key'] = $form_state['values']['menu_badges_callback'];
    }
  }
}