Full ELMS Learning Network documentation
function hook_init
×
Error message
User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).cis7 system.api.php | hook_init() |
cle7 system.api.php | hook_init() |
elmsmedia7 system.api.php | hook_init() |
icor7 system.api.php | hook_init() |
meedjum_blog7 system.api.php | hook_init() |
mooc7 system.api.php | hook_init() |
Perform setup tasks for non-cached page requests.
This hook is run at the beginning of the page request. It is typically used to set up global parameters that are needed later in the request. When this hook is called, the theme and all modules are already loaded in memory.
This hook is not run on cached pages.
To add CSS or JS that should be present on all pages, modules should not implement this hook, but declare these files in their .info file.
See also
Related topics
67 functions implement hook_init()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- accessibility_content_init in sites/
all/ modules/ ulmus/ accessibility/ modules/ accessibility_content/ accessibility_content.inc - actions_loop_test_init in modules/
simpletest/ tests/ actions_loop_test.module - Implements hook_init().
- advagg_bundler_init in sites/
all/ modules/ ulmus/ advagg/ advagg_bundler/ advagg_bundler.module - Implements hook_init().
- advagg_mod_init in sites/
all/ modules/ ulmus/ advagg/ advagg_mod/ advagg_mod.module - Implements hook_init().
- apc_init in sites/
all/ modules/ ulmus/ apc/ apc.module - Implementation of hook_init().
1 invocation of hook_init()
- _drupal_bootstrap_full in includes/
common.inc
File
- modules/
system/ system.api.php, line 1882 - Hooks provided by Drupal core and the System module.
Code
function hook_init() {
// Since this file should only be loaded on the front page, it cannot be
// declared in the info file.
if (drupal_is_front_page()) {
drupal_add_css(drupal_get_path('module', 'foo') . '/foo.css');
}
}