Submit handler for language negotiation settings.
function language_negotiation_configure_form_submit($form, &$form_state) {
$configurable_types = $form['#language_types'];
foreach ($configurable_types as $type) {
$method_weights = array();
$enabled_methods = $form_state['values'][$type]['enabled'];
$enabled_methods[LANGUAGE_NEGOTIATION_SELECTED] = TRUE;
$method_weights_input = $form_state['values'][$type]['weight'];
foreach ($method_weights_input as $method_id => $weight) {
if ($enabled_methods[$method_id]) {
$method_weights[$method_id] = $weight;
}
}
language_negotiation_set($type, $method_weights);
variable_set("language_negotiation_methods_weight_{$type}", $method_weights_input);
}
// Update non-configurable language types and the related language negotiation
// configuration.
language_types_set();
$form_state['redirect'] = 'admin/config/regional/language/detection';
drupal_set_message(t('Language negotiation configuration saved.'));
}