You are here

function hook_domain_bootstrap_full in Domain Access 7.3

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

Allows modules to execute code before Drupal's hook_boot().

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

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 and domain_id and any other values added during domain bootstrap phase 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_test_domain_bootstrap_full in tests/domain_test.module
Implements 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.

File

./domain.api.php, line 605
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';
}