You are here

function _domain_variable_realm_key in Domain Variable 7

Get realm key from domain array, machine_name or domain_id.

5 calls to _domain_variable_realm_key()
DomainVariableRealmController::getDefaultKey in ./domain_variable.class.inc
Implementation of VariableRealmControllerInterface::getDefaultKey().
DomainVariableRealmController::getRequestKey in ./domain_variable.class.inc
Implementation of VariableRealmControllerInterface::getRequestKey().
domain_variable_admin_variables in ./domain_variable.admin.inc
Variables settings form.
domain_variable_domain_delete in ./domain_variable.domain.inc
Implements hook_domain_delete().
domain_variable_get in ./domain_variable.module
Load a variable specific to a domain.

File

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

Code

function _domain_variable_realm_key($domain) {
  if (is_numeric($domain)) {
    return domain_load_machine_name($domain);
  }
  elseif (is_string($domain)) {
    return $domain;
  }
  elseif (is_array($domain)) {
    return isset($domain['machine_name']) ? $domain['machine_name'] : domain_load_machine_name($domain['domain_id']);
  }
  else {
    throw new InvalidArgumentException('Invalid argument value for $domain in function _domain_variable_realm_key(): ' . $domain);
  }
}