You are here

function domain_lang_types_set in Domain Lang 7

Updates the language type configuration for requested domain.

Parameters

int $domain_id: The unique domain ID that is being edited.

1 call to domain_lang_types_set()
domain_lang_detection_selection_form_submit in ./domain_lang.admin.inc
Domain language detection and selection form submit callback.

File

./domain_lang.module, line 140
Domain Language detection and selection module.

Code

function domain_lang_types_set($domain_id) {

  // Ensure that we are getting the defined language negotiation information. An
  // invocation of module_enable() or module_disable() could outdate the cached
  // information.
  drupal_static_reset('language_types_info');
  drupal_static_reset('language_negotiation_info');

  // Determine which language types are configurable and which not by checking
  // whether the 'fixed' key is defined. Non-configurable (fixed) language types
  // have their language negotiation settings stored there.
  $defined_providers = language_negotiation_info();
  foreach (language_types_info() as $type => $info) {
    if (isset($info['fixed'])) {
      $language_types[$type] = FALSE;
      $negotiation = array();
      foreach ($info['fixed'] as $weight => $id) {
        if (isset($defined_providers[$id])) {
          $negotiation[$id] = $weight;
        }
      }
      domain_lang_negotiation_set($domain_id, $type, $negotiation);
    }
    else {
      $language_types[$type] = TRUE;
    }
  }

  // Save language types.
  domain_conf_variable_set($domain_id, 'language_types', $language_types);

  // Ensure that subsequent calls of language_types_configurable() return the
  // updated language type information.
  drupal_static_reset('language_types_configurable');
}