You are here

function variable_realm_initialize in Variable 7.2

Initialize realm and set key depending on request.

Parameters

$realm_name: Variable realm name.

$realm_key: Optional key to be set when we don't have other key.

File

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

Code

function variable_realm_initialize($realm_name, $realm_key = NULL) {
  $realm_controller = variable_realm_controller($realm_name);
  if ($realm_controller && !$realm_controller
    ->isEnabled()) {
    $new_key = $realm_controller
      ->enable($realm_key);
    _variable_realm_invoke_all('variable_realm_enable', $realm_name, $new_key);
    _variable_realm_hook('variableRealmEnable', $realm_name, $new_key);

    // If we have already built the configuration, rebuild it.
    if ($new_key && drupal_static('variable_realm_rebuild')) {
      variable_realm_rebuild();
    }
  }
}