You are here

function variable_realm_add in Variable 7.2

Same name and namespace in other branches
  1. 7 variable_realm/variable_realm.module \variable_realm_add()

Set values for variable realm

Parameters

$realm: Realm name.

$key: Realm key.

$values: Array of runtime variable values to add to the realm.

$weight: Optional explicit weight for this realm.

$rebuild: Whether to rebuild domains immediately

2 calls to variable_realm_add()
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.

File

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

Code

function variable_realm_add($realm, $key, $values = array(), $weight = NULL, $rebuild = TRUE) {
  if ($variable_realm = variable_realm($realm, $key)) {
    foreach ($values as $name => $value) {
      $variable_realm
        ->variable_add($name, $value);
    }
    if (isset($weight)) {
      variable_realm_weight($realm, $weight);
    }

    // Rebuild only if this is the current realm
    if ($rebuild && variable_realm_status($realm) === $key) {
      variable_realm_rebuild();
    }
  }
}