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().
| Name | Location | Description |
|---|---|---|
| custom_url_rewrite_inbound | documentation/hooks/core.php | custom_url_rewrite_inbound is not a hook, it's a function you can add to settings.php to alter incoming requests so they map to a Drupal path. This function is called before modules are loaded and the menu system is initialized and it changes... |
| custom_url_rewrite_outbound | documentation/hooks/core.php | custom_url_rewrite_outbound is not a hook, it's a function you can add to settings.php to alter all links generated by Drupal. This function is called from url(). This function is called very frequently (100+ times per page) so performance... |
| hook_access | documentation/hooks/node.php | Define access restrictions. |
| hook_block | documentation/hooks/core.php | Declare a block or set of blocks. |
| hook_boot | documentation/hooks/core.php | Perform setup tasks. See also, hook_init. |
| hook_comment | documentation/hooks/core.php | Act on comments. |
| hook_cron | documentation/hooks/core.php | Perform periodic actions. |
| hook_db_rewrite_sql | documentation/hooks/core.php | Rewrite database queries, usually for access control. |
| hook_delete | documentation/hooks/node.php | Respond to node deletion. |
| hook_disable | documentation/hooks/install.php | Perform necessary actions before module is disabled. |
| hook_elements | documentation/hooks/core.php | Allows modules to declare their own Forms API element types and specify their default values. |
| hook_enable | documentation/hooks/install.php | Perform necessary actions after module is enabled. |
| hook_exit | documentation/hooks/core.php | Perform cleanup tasks. |
| hook_file_download | documentation/hooks/core.php | Allow file downloads. |
| hook_filter | documentation/hooks/core.php | Define content filters. |
| hook_filter_tips | documentation/hooks/core.php | Provide tips for using filters. |
| hook_footer | documentation/hooks/core.php | Insert closing HTML. |
| hook_form | documentation/hooks/node.php | Display a node editing form. |
| hook_forms | documentation/hooks/core.php | Map form_ids to builder functions. |
| hook_form_alter | documentation/hooks/core.php | Perform alterations before a form is rendered. |
| hook_help | documentation/hooks/core.php | Provide online user help. |
| hook_init | documentation/hooks/core.php | Perform setup tasks. See also, hook_boot. |
| hook_insert | documentation/hooks/node.php | Respond to node insertion. |
| hook_install | documentation/hooks/install.php | Install the current version of the database schema, and any other setup tasks. |
| hook_link | documentation/hooks/core.php | Define internal Drupal links. |
| hook_link_alter | documentation/hooks/core.php | Perform alterations before links on a node are rendered. One popular use of this hook is to add/delete links from other modules. |
| hook_load | documentation/hooks/node.php | Load node-type-specific information. |
| hook_mail | documentation/hooks/core.php | Prepare a message based on parameters. @see drupal_mail for more. |
| hook_mail_alter | documentation/hooks/core.php | Alter any aspect of the emails sent by Drupal. You can use this hook to add a common site footer to all outgoing emails; add extra header fields and/or modify the mails sent out in any way. HTML-izing the outgoing mails is one possibility. See also... |
| hook_menu | documentation/hooks/core.php | Define menu items and page callbacks. |
| hook_menu_alter | documentation/hooks/core.php | Alter the data being saved to the {menu_router} table after hook_menu is invoked. |
| hook_menu_link_alter | documentation/hooks/core.php | Alter the data being saved to the {menu_links} table by menu_link_save(). |
| hook_nodeapi | documentation/hooks/core.php | Act on nodes defined by other modules. |
| hook_node_access_records | documentation/hooks/core.php | Set permissions for a node to be written to the database. |
| hook_node_grants | documentation/hooks/core.php | Inform the node access system what permissions the user has. |
| hook_node_info | documentation/hooks/node.php | Define module-provided node types. |
| hook_node_operations | documentation/hooks/core.php | Add mass node operations. |
| hook_node_type | documentation/hooks/node.php | Act on node type changes. |
| hook_perm | documentation/hooks/core.php | Define user permissions. |
| hook_ping | documentation/hooks/core.php | Ping another server. |
| hook_prepare | documentation/hooks/node.php | This is a hook used by node modules. It is called after load but before the node is shown on the add/edit form. |
| hook_profile_alter | documentation/hooks/core.php | Perform alterations profile items before they are rendered. You may omit/add/re-sort/re-categorize, etc. |
| hook_requirements | documentation/hooks/install.php | Check installation requirements and do status reporting. |
| hook_schema | documentation/hooks/install.php | Define the current version of the database schema. |
| hook_search | documentation/hooks/core.php | Define a custom search routine. |
| hook_search_preprocess | documentation/hooks/core.php | Preprocess text for the search index. |
| hook_submit | documentation/hooks/node.php | This is a hook used by node modules. It is called after validation has succeeded and before insert/update. It is used to for actions which must happen only if the node is to be saved. Usually, $node is changed in some way and then the actual saving of... |
| hook_taxonomy | documentation/hooks/core.php | Act on taxonomy changes. |
| hook_theme | documentation/hooks/core.php | Register a module (or theme's) theme implementations. |
| hook_translated_menu_link_alter | documentation/hooks/core.php | Alter a menu link after it's translated, but before it's rendered. |
| hook_uninstall | documentation/hooks/install.php | Remove any tables or variables that the module sets. |
| hook_update | documentation/hooks/node.php | Respond to node updating. |
| hook_update_index | documentation/hooks/core.php | Update Drupal's full-text index for this module. |
| hook_update_N | documentation/hooks/install.php | Perform a single update. For each patch which requires a database change add a new hook_update_N() which will be called by update.php. |
| hook_user | documentation/hooks/core.php | Act on user account actions. |
| hook_user_operations | documentation/hooks/core.php | Add mass user operations. |
| hook_validate | documentation/hooks/node.php | Verify a node editing form. |
| hook_view | documentation/hooks/node.php | Display a node. |
| hook_watchdog | documentation/hooks/core.php | Log an event message |
| hook_xmlrpc | documentation/hooks/core.php | Register XML-RPC callbacks. |
| module_hook | 6/includes/module.inc | Determine whether a module implements a hook. |
| module_implements | 6/includes/module.inc | Determine which modules are implementing a hook. |
| module_invoke | 6/includes/module.inc | Invoke a hook in a particular module. |
| module_invoke_all | 6/includes/module.inc | Invoke a hook in all enabled modules that implement it. |
| text_content_is_empty | contributions/cck/examples/simple_field.php | Implementation of hook_content_is_empty(). |
| text_elements | contributions/cck/examples/example_field.php | Implementation of FAPI hook_elements(). |
| text_field | contributions/cck/examples/simple_field.php | Implementation of hook_field(). |
| text_field_formatter | contributions/cck/examples/simple_field.php | Implementation of hook_field_formatter(). |
| text_field_formatter_info | contributions/cck/examples/simple_field.php | Implementation of hook_field_formatter_info(). |
| text_field_info | contributions/cck/examples/simple_field.php | Implementation of hook_field_info(). |
| text_field_settings | contributions/cck/examples/simple_field.php | Implementation of hook_field_settings(). |
| text_textarea_process | contributions/cck/examples/example_field.php | Process an individual element. |
| text_textfield_process | contributions/cck/examples/example_field.php | Process an individual element. |
| text_theme | contributions/cck/examples/simple_field.php | Implementation of hook_theme(). |
| text_widget | contributions/cck/examples/simple_field.php | Implementation of hook_widget(). |
| text_widget_info | contributions/cck/examples/simple_field.php | Implementation of hook_widget_info(). |
| text_widget_settings | contributions/cck/examples/simple_field.php | Implementation of hook_widget_settings(). |
| theme_text_textfield | contributions/cck/examples/example_field.php | FAPI theme for an individual text elements. |