You are here

function menu_block_admin_settings_form_submit in Menu Block 6.2

Same name and namespace in other branches
  1. 7.3 menu_block.admin.inc \menu_block_admin_settings_form_submit()
  2. 7.2 menu_block.admin.inc \menu_block_admin_settings_form_submit()

Form submission handler.

File

./menu_block.admin.inc, line 438
Provides infrequently used functions for menu_block.

Code

function menu_block_admin_settings_form_submit($form, &$form_state) {
  $menu_order = array();
  foreach ($form_state['values']['menu_order'] as $menu_name => $row) {
    if ($row['available']) {

      // Add available menu and its weight to list.
      $menu_order[$menu_name] = (int) $row['weight'];
    }
  }

  // Sort the keys by the weight stored in the value.
  asort($menu_order);
  foreach ($menu_order as $menu_name => $weight) {

    // Now that the array is sorted, the weight is redundant data.
    $menu_order[$menu_name] = '';
  }
  variable_set('menu_block_menu_order', $menu_order);
}