You are here

function domain_conf_js_maintain in Domain Access 7.3

Same name and namespace in other branches
  1. 7.2 domain_conf/domain_conf.module \domain_conf_js_maintain()

Ensure that language changes do not affect default settings.

When using multiple languages with JavaScript translations, the invocation of _locale_rebuild_js() can force the default domain setting to be assigned to the active domain. Hilarity foes not ensue.

We try to account for this issue by ensuring that the default setting is not changed when this function is invoked, which can happen in two places: locale_js_alter() and locale_languages_delete_form_submit(). Fortunately, both function are tied to hook that we can monitor in order to ensure that the settings are preserved properly.

@link http://drupal.org/node/1271810

See also

_locale_rebuild_js()

locale_languages_delete_form_submit()

hook_multilingual_settings_changed()

domain_conf_js_alter()

domain_conf_multilingual_settings_changed()

2 calls to domain_conf_js_maintain()
domain_conf_js_alter in domain_conf/domain_conf.module
Implements hook_js_alter().
domain_conf_multilingual_settings_changed in domain_conf/domain_conf.module
Implements hook_multilingual_settings_changed().

File

domain_conf/domain_conf.module, line 511
Domain manager configuration options.

Code

function domain_conf_js_maintain() {

  // Only a factor if using the Locale module.
  if (!module_exists('locale')) {
    return;
  }
  if ($default_language = domain_conf_default_language()) {
    drupal_register_shutdown_function('domain_conf_set_default_language', $default_language);
  }
}