You are here

function domain_conf_variable_get in Domain Access 7.3

Same name and namespace in other branches
  1. 6.2 domain_conf/domain_conf.module \domain_conf_variable_get()
  2. 7.2 domain_conf/domain_conf.module \domain_conf_variable_get()

Load a variable specific to a domain.

Parameters

$domain_id: The unique domain 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 domain. Useful if you are changing variables during a page request.

Return value

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

2 calls to domain_conf_variable_get()
domain_conf_form in domain_conf/domain_conf.admin.inc
Custom form to generate domain-specific site settings.
drush_domain_conf_get in domain_conf/domain_conf.drush.inc

File

domain_conf/domain_conf.module, line 367
Domain manager configuration options.

Code

function domain_conf_variable_get($domain_id, $variable = '', $all = FALSE, $reset = FALSE) {
  $_domain = domain_get_domain();
  $settings =& drupal_static(__FUNCTION__ . '_settings');
  $base =& drupal_static(__FUNCTION__ . '_base');
  if (empty($base)) {
    $base = _domain_conf_load_primary(FALSE);
  }
  if (!isset($settings[$domain_id]) || $reset) {

    // Get the current settings for this domain, if any.
    $data = domain_conf_data_get($domain_id, $reset);
    $settings[$domain_id] = array_merge($base, $data);
  }
  if ($all) {
    return $settings[$domain_id];
  }
  if (isset($settings[$domain_id][$variable])) {
    return $settings[$domain_id][$variable];
  }
  return NULL;
}