hook_init

Versions
4.6 – 7
hook_init()

Perform setup tasks. See also, hook_boot.

This hook is run at the beginning of the page request. It is typically used to set up global parameters which are needed later in the request. when this hook is called, all modules are already loaded in memory.

For example, this hook is a typical place for modules to add CSS or JS that should be present on every page. This hook is not run on cached pages - though CSS or JS added this way will be present on a cached page.

Related topics

Code

modules/system/system.api.php, line 729

<?php
function hook_init() {
  drupal_add_css(drupal_get_path('module', 'book') . '/book.css');
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.