You are here

function language_negotiation_purge in Drupal 7

Removes any unused language negotiation providers from the configuration.

Related topics

1 call to language_negotiation_purge()
locale_modules_enabled in modules/locale/locale.module
Implements hook_modules_enabled().

File

includes/language.inc, line 318
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');
  $defined_providers = language_negotiation_info();
  foreach (language_types_info() as $type => $type_info) {
    $weight = 0;
    $negotiation = array();
    foreach (variable_get("language_negotiation_{$type}", array()) as $id => $provider) {
      if (isset($defined_providers[$id])) {
        $negotiation[$id] = $weight++;
      }
    }
    language_negotiation_set($type, $negotiation);
  }
}