1. 8.5.x core/core.api.php hooks
  2. 8.0.x core/core.api.php hooks
  3. 8.1.x core/core.api.php hooks
  4. 8.2.x core/core.api.php hooks
  5. 8.3.x core/core.api.php hooks
  6. 8.4.x core/core.api.php hooks
  7. 8.6.x core/core.api.php hooks
  8. 4.6.x includes/module.inc hooks
  9. 4.7.x includes/module.inc hooks
  10. 5.x includes/module.inc hooks
  11. 6.x includes/module.inc hooks
  12. 7.x includes/module.inc 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 call 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 is 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().


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


Namesort descending Location Description
hook_access developer/hooks/node.php Define access restrictions.
hook_auth developer/hooks/authentication.php Verify authentication of a user.
hook_block developer/hooks/core.php Declare a block or set of blocks.
hook_comment developer/hooks/core.php Act on comment modification.
hook_cron developer/hooks/core.php Perform periodic actions.
hook_db_rewrite_sql developer/hooks/core.php Add JOIN and WHERE statements to queries and decide whether the primary_field shall be made DISTINCT. For node objects, primary field is always called nid. For taxonomy terms, it is tid and for vocabularies it is vid. For comments, it is cid. Note…
hook_delete developer/hooks/node.php Respond to node deletion.
hook_exit developer/hooks/core.php Perform cleanup tasks.
hook_filter developer/hooks/core.php Define content filters.
hook_filter_tips developer/hooks/core.php Provide tips for using filters.
hook_footer developer/hooks/core.php Insert closing HTML.
hook_form developer/hooks/node.php Display a node editing form.
hook_help developer/hooks/core.php Provide online user help.
hook_info developer/hooks/authentication.php Declare authentication scheme information.
hook_init developer/hooks/core.php Perform setup tasks.
hook_insert developer/hooks/node.php Respond to node insertion.
hook_link developer/hooks/core.php Define internal Drupal links.
hook_load developer/hooks/node.php Load node-type-specific information.
hook_menu developer/hooks/core.php Define menu items and page callbacks.
hook_nodeapi developer/hooks/core.php Act on nodes defined by other modules.
hook_node_grants developer/hooks/core.php Grant access to nodes.
hook_node_name developer/hooks/node.php Define the human-readable name of a node type.
hook_node_types developer/hooks/node.php Define multiple node types.
hook_onload developer/hooks/core.php Insert a JavaScript onload handler.
hook_perm developer/hooks/core.php Define user permissions.
hook_ping developer/hooks/core.php Ping another server.
hook_search developer/hooks/core.php Define a custom search routine.
hook_search_item developer/hooks/core.php Format a search result.
hook_search_preprocess developer/hooks/core.php Preprocess text for the search index.
hook_settings developer/hooks/core.php Declare administrative settings for a module.
hook_taxonomy developer/hooks/core.php Act on taxonomy changes.
hook_textarea developer/hooks/core.php React to textarea additions.
hook_update developer/hooks/node.php Respond to node updating.
hook_update_index developer/hooks/core.php Update Drupal's full-text index for this module.
hook_user developer/hooks/core.php Act on user account actions.
hook_validate developer/hooks/node.php Verify a node editing form.
hook_view developer/hooks/node.php Display a node.
hook_xmlrpc developer/hooks/core.php Register XML-RPC callbacks.
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.