You are here

function hook_domain_bootstrap_lookup in Domain Access 7.3

Same name and namespace in other branches
  1. 6.2 API.php \hook_domain_bootstrap_lookup()
  2. 7.2 domain.api.php \hook_domain_bootstrap_lookup()

Allow modules to modify the lookup of the domain record.

During the bootstrap phase, Domain Access will try to assign the active domain based on the inbound HTTP_HOST request. Modules using this hook may alter this behavior in order to account for special conditions.

This alteration happens before any other module functions are called, so it allows you to modify which domain is loaded at the start of a page request.

For example, Domain Alias can change the domain_id matched to the current domain name before related information is retrieved during domain_init().

Note: Because this function is usually called VERY early, many Drupal functions or modules won't be loaded yet.

Warning: do _not_ call domain_lookup() or domain_load() from within this function. Doing so may cause critical errors.

Parameters

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

Return value

An array containing at least a valid domain_id.

2 functions implement hook_domain_bootstrap_lookup()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

domain_alias_domain_bootstrap_lookup in domain_alias/domain_alias.module
Implements hook_domain_bootstrap_lookup().
domain_test_domain_bootstrap_lookup in tests/domain_test.module
Implements hook_domain_bootstrap_lookup().
1 invocation of hook_domain_bootstrap_lookup()
domain_bootstrap_register in ./domain.module
Register the modules needed to load during bootstrap.

File

./domain.api.php, line 572
API documentation file.

Code

function hook_domain_bootstrap_lookup($domain) {

  // Match en.example.org to default domain (id:0)
  if ($domain['subdomain'] == 'en.example.org') {
    $domain['domain_id'] = 0;
  }
  return $domain;
}