You are here

function domain_lang_detection_selection_form_submit in Domain Lang 7

Domain language detection and selection form submit callback.

1 string reference to 'domain_lang_detection_selection_form_submit'
domain_lang_detection_selection_form in ./domain_lang.admin.inc
Domain language detection and selection page form callback.

File

./domain_lang.admin.inc, line 35
Domain Language detection and selection administration pages.

Code

function domain_lang_detection_selection_form_submit($form, &$form_state) {
  $domain_id = (int) $form_state['values']['domain_id'];
  $configurable_types = $form['#language_types'];
  foreach ($configurable_types as $type) {
    $negotiation = array();
    $enabled_providers = $form_state['values'][$type]['enabled'];
    $enabled_providers[LANGUAGE_NEGOTIATION_DEFAULT] = TRUE;
    $providers_weight = $form_state['values'][$type]['weight'];
    foreach ($providers_weight as $id => $weight) {
      if ($enabled_providers[$id]) {
        $provider = $form[$type]['#language_providers'][$id];
        $provider['weight'] = $weight;
        $negotiation[$id] = $provider;
      }
    }
    domain_lang_negotiation_set($domain_id, $type, $negotiation);
    domain_conf_variable_set($domain_id, "locale_language_providers_weight_{$type}", $providers_weight);
  }

  // Update non-configurable language types and the related language negotiation
  // configuration.
  domain_lang_types_set($domain_id);
  drupal_set_message(t('Language negotiation configuration saved.'));
}