hook_domain_bootstrap_full

Versions
domain
hook_domain_bootstrap_full($domain)

Hook hook_domain_bootstrap_full allows modules to execute code after the domain bootstrap phases which is called before drupal's hook_boot().

This hook can be used to modify drupal's variables system or prefix database tables, as used in the modules domain_conf and domain_prefix.

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().

Normally, you do not need to validate errors, since this function will not be called unless $domain is set properly.

Parameters

$domain An array containing current domain and domain_id and any other values added during domain bootstrap phase 2 (DOMAIN_BOOTSTRAP_DOMAINNAME_RESOLVE).

Return value

No return value. However, if you wish to set an error message on failure, you should load and modify the $_domain global and add an 'error' element to the array. This element should only include the name of your module. We do this because drupal_set_message() and t() are not yet loaded.

Code

./API.php, line 641

<?php
function hook_domain_bootstrap_full($domain) {
  global $conf;
  // The language variable should not be set yet.
  // Check for errors.
  if (isset($conf['language'])) {
    global $_domain;
    $_domain['error'] = 'mymodule';
    return;
  }
  // Our test module sets the default language to Spanish.
  $conf['language'] = 'es';
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List