You are here

function hook_domain_bootstrap_full in Domain Access 6.2

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

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

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.

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

2 functions implement hook_domain_bootstrap_full()

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

domain_conf_domain_bootstrap_full in domain_conf/domain_conf.module
Implements hook_domain_bootstrap_full().
domain_prefix_domain_bootstrap_full in domain_prefix/domain_prefix.module
Implementats hook_domain_bootstrap_full().
1 invocation of hook_domain_bootstrap_full()
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 648
API documentation file.

Code

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';
}