You are here

function hook_domain_bootstrap_lookup in Domain Access 6.2

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

Hook domain_bootstrap_lookup allows modules to modify the domain record used on the current page on bootstrap level, that is, before it is used anywhere else.

This allows modules like Domain Alias to 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.

In order for this hook to work your module needs to be registered with domain_bootstrap_register() during hook_enable();

Modules must also use domain_bootsrap_unregister('mymodule') during hook_disable().

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.

1 function implements 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
Implement 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. Stores results in the 'domain_bootstrap_modules' variable.

File

./API.php, line 612
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;
}