You are here

function domain_default in Domain Access 6.2

Same name and namespace in other branches
  1. 5 domain.module \domain_default()
  2. 7.3 domain.module \domain_default()
  3. 7.2 domain.module \domain_default()

Assigns the default settings to domain 0, the root domain.

This value is used throughout the modules. Even though this record is in the {domain} table, we use the value stored as a variable. Doing so prevents the module from firing when it has not been configured.

Parameters

$reset: A boolean flag indicating whether to reset the static array or not.

$alter: A boolean flag indicating whether to allow hook_domainload(). In some cases where external scripts do not pass an HTTP_HOST, Drupal does not behave as expected and we cannot trigger this API call.

Return value

The domain array for the default domain.

See also

domain_request_name()

19 calls to domain_default()
domain_check_primary in ./domain.module
Check to see if a redirect to the primary domain is needed.
domain_configure_form_submit in ./domain.admin.inc
Save any changes to the primary domain record.
domain_domains in ./domain.module
Return all active domains (including the default) as an array.
domain_form_alter in ./domain.module
Implement hook_form_alter()
domain_init in ./domain.module
Implement hook_init().

... See full list

File

./domain.module, line 881
Core module functions for the Domain Access suite.

Code

function domain_default($reset = FALSE, $alter = TRUE) {
  static $default;
  if (empty($default) || $reset) {
    $default['domain_id'] = 0;
    $default['sitename'] = variable_get('domain_sitename', variable_get('site_name', 'Drupal'));
    $default['subdomain'] = variable_get('domain_root', '');
    $default['scheme'] = variable_get('domain_scheme', 'http');

    // Set the valid flag.
    $default['valid'] = TRUE;
    if ($alter) {

      // Let submodules overwrite the defaults, if they wish.
      $default = domain_api($default, $reset);
    }
  }
  return $default;
}