You are here

function variable_realm_switch in Variable 7

Same name and namespace in other branches
  1. 7.2 variable_realm/variable_realm.module \variable_realm_switch()

Switch current variable realms.

Parameters

$realm: Realm name. Example 'language'.

$key: Realm key. Example, for language will be a language code, 'en FALSE to unset the realm.

See also

variable_realm_weight()

4 calls to variable_realm_switch()
VariableStoreTestCase::testVariableStoreAPI in variable_store/variable_store.test
Test that all core modules can be enabled, disabled and uninstalled.
variable_example_page_realm in variable_example/variable_example.module
Variable example realm page.
variable_realm_init in variable_realm/variable_realm.module
Implements hook_init()
variable_realm_union_variable_realm_switch in variable_realm_union/variable_realm_union.module
Implements hook_variable_realm_switch().

File

variable_realm/variable_realm.module, line 387
Variable API module - Realms

Code

function variable_realm_switch($realm, $key) {

  // Check previous status, if not changed no need to rebuild.
  $current = variable_realm_status($realm);
  if (!isset($current) || $current !== $key) {
    variable_realm_status($realm, $key);
    module_invoke_all('variable_realm_switch', $realm, $key);
    variable_realm_rebuild();
  }
}