function language_negotiation_purge

Removes any language negotiation methods that are no longer defined.

Related topics

1 call to language_negotiation_purge()
language_modules_enabled in drupal/core/modules/language/language.module
Implements hook_modules_enabled().

File

drupal/core/includes/language.inc, line 336
Language Negotiation API.

Code

function language_negotiation_purge() {

  // 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_negotiation_info');
  drupal_static_reset('language_types_info');
  $negotiation_info = language_negotiation_info();
  foreach (language_types_info() as $type => $type_info) {
    $weight = 0;
    $method_weights = array();
    foreach (variable_get("language_negotiation_{$type}", array()) as $method_id => $method) {
      if (isset($negotiation_info[$method_id])) {
        $method_weights[$method_id] = $weight++;
      }
    }
    language_negotiation_set($type, $method_weights);
  }
}