You are here

function domain_alias_domain_bootstrap_lookup in Domain Access 6.2

Same name and namespace in other branches
  1. 7.3 domain_alias/domain_alias.module \domain_alias_domain_bootstrap_lookup()
  2. 7.2 domain_alias/domain_alias.module \domain_alias_domain_bootstrap_lookup()

Implement hook_domain_bootstrap_lookup().

Tries to match the given domain name against patterns in the {domain_alias} table and, if successful, updates information in given parameter $domain.

Parameters

$domain: An array containing current domain (host) name and the results of lookup against {domain} table.

Return value

An array containing at least a valid domain_id. Other values are: -- 'active_alias_id' => the currently active alias. -- 'redirect' => a boolean flag telling the module to redirect to the registered domain name if accessed from an alias.

See also

domain_resolve_name()

File

domain_alias/domain_alias.module, line 39
Interface for advanced domain matching for Domain Access.

Code

function domain_alias_domain_bootstrap_lookup($domain) {

  // If we had an exact match, then $domain['sitename'] is populated.
  // Otherwise, we must do an advanced check.
  if (isset($domain['sitename'])) {
    return;
  }
  $alias = domain_alias_lookup($domain['subdomain']);
  if ($alias != -1) {
    $domain['domain_id'] = $alias['domain_id'];
    $domain['active_alias_id'] = $alias['alias_id'];
    $domain['redirect'] = (bool) $alias['redirect'];
    return $domain;
  }
}