You are here

function environment_indicator_variable_get in Environment Indicator 7.2

Load a variable specific to an environment.

Parameters

$environment_id: The unique environment ID that is being edited.

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

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

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

Return value

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

File

environment_indicator_variable/environment_indicator_variable.module, line 76
Module implementation file.

Code

function environment_indicator_variable_get($environment_id, $variable = '', $all = FALSE, $reset = FALSE) {
  if ($reset) {

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