hook_domain_bootstrap_lookup

Versions
domain
hook_domain_bootstrap_lookup($domain)

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.

Code

./API.php, line 605

<?php
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;
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List