1.20.x locale.admin.inc language_negotiation_configure_form_submit($form, &$form_state)

Submit handler for language negotiation settings.

File

modules/locale/locale.admin.inc, line 121
Admin page callbacks for the Locale module.

Code

function language_negotiation_configure_form_submit($form, &$form_state) {
  $configurable_types = $form['#language_types'];

  foreach ($configurable_types as $type) {
    $negotiation = array();
    $providers = $form_state['values'][$type];
    $providers[LANGUAGE_NEGOTIATION_DEFAULT]['enabled'] = 1;
    backdrop_sort($providers);

    foreach ($providers as $id => $provider_settings) {
      if ($provider_settings['enabled']) {
        $negotiation[] = $id;
      }
    }

    language_negotiation_set($type, $negotiation);
  }

  $form_state['redirect'] = 'admin/config/regional/language/detection';
  backdrop_set_message(t('Language negotiation configuration saved.'));
}