function locale_update_8004

Rename language providers to language negotiation methods.

Related topics

File

drupal/core/modules/locale/locale.install, line 505
Install, update, and uninstall functions for the Locale module.

Code

function locale_update_8004() {
  $types = update_variable_get('language_types', NULL);
  if (!empty($types)) {
    foreach ($types as $type => $configurable) {

      // Rename the negotiation and language switch callback keys.
      $negotiation = update_variable_get('language_negotiation_' . $type, NULL);
      if (!empty($negotiation)) {
        foreach ($negotiation as $method_id => &$method) {
          if (isset($method['callbacks']['language'])) {
            $method['callbacks']['negotiation'] = $method['callbacks']['language'];
            unset($method['callbacks']['language']);
          }
          if (isset($method['callbacks']['switcher'])) {
            $method['callbacks']['language_switch'] = $method['callbacks']['switcher'];
            unset($method['callbacks']['switcher']);
          }
        }
        update_variable_set('language_negotiation_' . $type, $negotiation);
      }

      // Rename the language negotiation methods weight variable.
      $weight = update_variable_get('locale_language_providers_weight_' . $type, NULL);
      if ($weight !== NULL) {
        update_variable_set('language_negotiation_methods_weight_' . $type, $weight);
        update_variable_del('locale_language_providers_weight_' . $type);
      }
    }
  }
}