function hook_init

Allows each module to execute code when the module is first loaded.

Typically, this means that we will execute code when the page is first loaded. Also useful for including javascript or CSS on the page, but only under certain conditions (like who the user is, or what permissions they have)

See also

hook_exit

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

advise_init in modules/advise/advise.module
Implementation of hook_init
example_helper_init in custom/modules/example_helper/example_helper.module
Implementation of "hook_init".
system_init in modules/system/system.module
Called on every page load.
tinymce_init in modules/tinymce/tinymce.module

File

includes/hook.api.php, line 496
Lists all available hooks within FlightPath's core code.

Code

function hook_init() {
  // Perform actions when page is loaded...
  if (user_has_access("some_permission")) {
    $GLOBALS ["some_variable"] = TRUE;
  }
}