function custom_breadcrumbs_admin_settings_submit in Custom Breadcrumbs 6.2
Same name and namespace in other branches
- 7.2 custom_breadcrumbs.admin.inc \custom_breadcrumbs_admin_settings_submit()
Form submission handler for custom_breadcrumbs_admin_settings().
See also
custom_breadcrumbs_admin_settings()
1 string reference to 'custom_breadcrumbs_admin_settings_submit'
- custom_breadcrumbs_admin_settings in ./
custom_breadcrumbs.admin.inc - Form builder; Configure basic and advanced custom breadcrumbs settings for this site.
File
- ./
custom_breadcrumbs.admin.inc, line 575 - Admin page callback file for the custom_breadcrumbs module.
Code
function custom_breadcrumbs_admin_settings_submit($form, &$form_state) {
if (!empty($form['adv_settings']['module_weights']['table']) && $form_state['values']['custom_breadcrumbs_adjust_module_weights']) {
// Set the initial weight of the lightest module to zero.
$current_mod_weight = 0;
$table = array(
'module name' => array(),
'table weight' => array(),
'module weight' => array(),
);
// Prepare module table that can be sorted by table weight.
foreach ($form_state['values']['table'] as $module_id => $value) {
if (is_numeric($module_id)) {
$module = $form['adv_settings']['module_weights']['table'][$module_id]['#module'];
$table['table weight'][$module] = $form_state['values']['table'][$module_id]['weight'];
$table['module weight'][$module] = $form['adv_settings']['module_weights']['table'][$module_id]['#weight'];
}
}
// Sort module list by table weight.
array_multisort($table['table weight'], $table['module weight']);
foreach ($table['module weight'] as $module => $orig_weight) {
// Find the module's minimum weight determined by dependence on other modules.
$func = $module . '_minimum_module_weight';
$min = function_exists($func) ? $func() : 0;
$weight = max($min, $current_mod_weight);
// Update module weight in the system table if it has changed.
if ($orig_weight != $weight) {
db_query("UPDATE {system} SET weight = %d WHERE name = '%s'", $weight, $module);
variable_set('menu_rebuild_needed', TRUE);
}
$current_mod_weight = $weight + 1;
}
}
// Rebuild the theme registry if custom_breadcrumbs_force_active_trail has changed.
if ($form_state['values']['custom_breadcrumbs_force_active_trail'] != $form['adv_settings']['custom_breadcrumbs_force_active_trail']['#default_value']) {
drupal_rebuild_theme_registry();
drupal_set_message(t('The theme registry has been rebuilt'));
}
}