function hook_init

Same name and namespace in other branches
  1. 7.x drupal-7.x/modules/system/system.api.php \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.

Return value

None.

Related topics

15 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.

aggregator_init in drupal-6.x/modules/aggregator/aggregator.module
Implementation of hook_init().
blogapi_init in drupal-6.x/modules/blogapi/blogapi.module
book_init in drupal-6.x/modules/book/book.module
Implementation of hook_init(). Add's the book module's CSS.
conf_init in drupal-6.x/includes/bootstrap.inc
Loads the configuration and sets the base URL, cookie domain, and session name correctly.
dblog_init in drupal-6.x/modules/dblog/dblog.module

... See full list

1 invocation of hook_init()
_drupal_bootstrap_full in drupal-6.x/includes/common.inc

Archivo

documentation-6.x/developer/hooks/core.php, line 949
These are the hooks that are invoked by the Drupal core.

Código

function hook_init() {
  drupal_add_css(drupal_get_path('module', 'book') . '/book.css');
}