You are here

function domain_variable_get in Domain Variable 7

Load a variable specific to a domain.

Parameters

string $domain_id: The unique domain ID that is being edited.

string $variable: The name of the variable you wish to get.

bool $all: A boolean flag indicating whether to return the entire variable array.

bool $reset: A boolean flag to reset the static variable array for the domain. Useful if you are changing variables during a page request.

Return value

mixed The value of the variable for that domain, or NULL if not set, or an array of variables, in the case of $all.

File

./domain_variable.module, line 147
domain_variable Domain Variable: configuration extension Functions for the Domain Variable module.

Code

function domain_variable_get($domain_id, $variable = '', $all = FALSE, $reset = FALSE) {
  $realm_key = _domain_variable_realm_key($domain_id);
  if ($reset) {

    // Reinitialize the variable realm from stored values.
    $variables = variable_store('domain', $realm_key);
    variable_realm_add('domain', $realm_key, $variables);
  }
  if ($all) {
    return variable_store('domain', $realm_key);
  }
  else {
    return variable_store_get('domain', $realm_key, $variable);
  }
}