1 language.inc language_negotiation_set($type, $negotiation)

Saves a list of language negotiation providers.

Parameters

$type: The language negotiation type.

$negotiation: An array of language negotiation providers in the order they should be executed.

Related topics

File

core/includes/language.inc, line 333
Language Negotiation API.

Code

function language_negotiation_set($type, $negotiation) {
  $defined_providers = language_negotiation_info();
  $default_types = language_types_get_configurable();
  $negotiation_data = array();

  foreach ($negotiation as $id) {
    if (isset($defined_providers[$id])) {
      $provider = $defined_providers[$id];
      // If the provider does not express any preference about types, make it
      // available for any configurable type.
      $types = array_flip(isset($provider['types']) ? $provider['types'] : $default_types);
      // Check whether the provider is defined and has the right type.
      if (isset($types[$type])) {
        $negotiation_data[] = $id;
      }
    }
  }

  config_set('language.settings', "language_negotiation.$type", $negotiation_data);
}