You are here

Hooks in Drupal 6

Same name and namespace in other branches
  1. 8 core/core.api.php \hooks
  2. 4 includes/module.inc \hooks
  3. 5 includes/module.inc \hooks
  4. 7 includes/module.inc \hooks
  5. 9 core/core.api.php \hooks

Allow modules to interact with the Drupal core.

Drupal's module system is based on the concept of "hooks". A hook is a PHP function that is named foo_bar(), where "foo" is the name of the module (whose filename is thus foo.module) and "bar" is the name of the hook. Each hook has a defined set of parameters and a specified result type.

To extend Drupal, a module need simply implement a hook. When Drupal wishes to allow intervention from modules, it determines which modules implement a hook and calls that hook in all enabled modules that implement it.

The available hooks to implement are explained here in the Hooks section of the developer documentation. The string "hook" is used as a placeholder for the module name in the hook definitions. For example, if the module file is called example.module, then hook_help() as implemented by that module would be defined as example_help().

File

includes/module.inc, line 379
API for loading and interacting with Drupal modules.

Functions

Namesort descending Location Description
module_hook includes/module.inc Determine whether a module implements a hook.
module_implements includes/module.inc Determine which modules are implementing a hook.
module_invoke includes/module.inc Invoke a hook in a particular module.
module_invoke_all includes/module.inc Invoke a hook in all enabled modules that implement it.