function menu_block_admin_settings_form_submit in Menu Block 7.2
Same name and namespace in other branches
- 6.2 menu_block.admin.inc \menu_block_admin_settings_form_submit()
- 7.3 menu_block.admin.inc \menu_block_admin_settings_form_submit()
Form submission handler.
1 string reference to 'menu_block_admin_settings_form_submit'
- menu_block_admin_settings_form in ./
menu_block.admin.inc - Menu callback: admin settings form.
File
- ./
menu_block.admin.inc, line 543 - Provides infrequently used functions and hooks 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'];
}
}
// Clear menu_order before it's written to the variable table by system_settings_form_submit().
unset($form_state['values']['menu_order']);
// 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] = '';
}
// Add the menu_order to the values.
$form_state['values']['menu_block_menu_order'] = $menu_order;
}