You are here

function variable_realm_controller in Variable 7.2

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

Get variable realm controller or create it if not defined.

20 calls to variable_realm_controller()
VariableRealmUnionController::__construct in variable_realm/variable_realm_union.class.inc
Implementation of VariableRealmControllerInterface::__construct().
variable_admin_realm_info in variable_admin/variable_admin.inc
Lists available realms.
variable_admin_realm_overview in variable_admin/variable_admin.inc
Lists available realms.
variable_realm in variable_realm/variable_realm.module
Get variable realm store.
variable_realm_current in variable_realm/variable_realm.module
Get active realm controllers ordered by weight.

... See full list

File

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

Code

function variable_realm_controller($realm_name = NULL) {
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['realm'] =& drupal_static(__FUNCTION__, array());
    if ($global = _variable_realm_controller('global')) {
      $global
        ->addStore('default', $GLOBALS['conf']);
      $drupal_static_fast['realm']['global'] = $global;
    }
  }
  $variable_realm =& $drupal_static_fast['realm'];
  if ($realm_name) {
    if (!isset($variable_realm[$realm_name])) {
      $variable_realm[$realm_name] = _variable_realm_controller($realm_name);
    }
    return $variable_realm[$realm_name];
  }
  else {

    // Return only existing realms.
    return array_filter($variable_realm);
  }
}