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().

Functions

Namesort iconLocationDescription
custom_url_rewrite_inboundcontributions/docs/developer/hooks/core.phpcustom_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_outboundcontributions/docs/developer/hooks/core.phpcustom_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_accesscontributions/docs/developer/hooks/node.phpDefine access restrictions.
hook_actions_deletecontributions/docs/developer/hooks/core.phpExecute code after an action is deleted.
hook_action_infocontributions/docs/developer/hooks/core.phpDeclare information about one or more Drupal actions.
hook_action_info_altercontributions/docs/developer/hooks/core.phpAlter the actions declared by another module.
hook_blockcontributions/docs/developer/hooks/core.phpDeclare a block or set of blocks.
hook_bootcontributions/docs/developer/hooks/core.phpPerform setup tasks. See also, hook_init.
hook_commentcontributions/docs/developer/hooks/core.phpAct on comments.
hook_croncontributions/docs/developer/hooks/core.phpPerform periodic actions.
hook_db_rewrite_sqlcontributions/docs/developer/hooks/core.phpRewrite database queries, usually for access control.
hook_deletecontributions/docs/developer/hooks/node.phpRespond to node deletion.
hook_disablecontributions/docs/developer/hooks/install.phpPerform necessary actions before module is disabled.
hook_elementscontributions/docs/developer/hooks/core.phpAllows modules to declare their own Forms API element types and specify their default values.
hook_enablecontributions/docs/developer/hooks/install.phpPerform necessary actions after module is enabled.
hook_exitcontributions/docs/developer/hooks/core.phpPerform cleanup tasks.
hook_file_copycontributions/docs/developer/hooks/file.phpRespond to a file that has been copied.
hook_file_deletecontributions/docs/developer/hooks/file.phpRespond to a file being deleted.
hook_file_downloadcontributions/docs/developer/hooks/file.phpControl access to private file downloads and specify HTTP headers.
hook_file_insertcontributions/docs/developer/hooks/file.phpRespond to a file being added.
hook_file_loadcontributions/docs/developer/hooks/file.phpLoad additional information into a file object.
hook_file_movecontributions/docs/developer/hooks/file.phpRespond to a file that has been moved.
hook_file_referencescontributions/docs/developer/hooks/file.phpReport the number of times a file is referenced by a module.
hook_file_statuscontributions/docs/developer/hooks/file.phpRespond to a file that has changed status.
hook_file_updatecontributions/docs/developer/hooks/file.phpRespond to a file being updated.
hook_file_validatecontributions/docs/developer/hooks/file.phpCheck that files meet a given criteria.
hook_filtercontributions/docs/developer/hooks/core.phpDefine content filters.
hook_filter_tipscontributions/docs/developer/hooks/core.phpProvide tips for using filters.
hook_flush_cachescontributions/docs/developer/hooks/core.phpAdd a list of cache tables to be cleared.
hook_footercontributions/docs/developer/hooks/core.phpInsert closing HTML.
hook_formcontributions/docs/developer/hooks/node.phpDisplay a node editing form.
hook_formscontributions/docs/developer/hooks/core.phpMap form_ids to builder functions.
hook_form_altercontributions/docs/developer/hooks/core.phpPerform alterations before a form is rendered.
hook_form_FORM_ID_altercontributions/docs/developer/hooks/core.phpProvide a form-specific alteration instead of the global hook_form_alter().
hook_helpcontributions/docs/developer/hooks/core.phpProvide online user help.
hook_hook_infocontributions/docs/developer/hooks/core.phpExpose a list of triggers (events) that your module is allowing users to assign actions to.
hook_image_toolkitscontributions/docs/developer/hooks/core.phpDefine image toolkits provided by this module. * The file which includes each toolkit's functions must be declared as part of the files array in the module .info file so that the registry will find and parse it. * *
hook_initcontributions/docs/developer/hooks/core.phpPerform setup tasks. See also, hook_boot.
hook_insertcontributions/docs/developer/hooks/node.phpRespond to node insertion.
hook_installcontributions/docs/developer/hooks/install.phpInstall the current version of the database schema, and any other setup tasks.
hook_linkcontributions/docs/developer/hooks/core.phpDefine internal Drupal links.
hook_link_altercontributions/docs/developer/hooks/core.phpPerform alterations before links on a node are rendered. One popular use of this hook is to add/delete links from other modules.
hook_loadcontributions/docs/developer/hooks/node.phpLoad node-type-specific information.
hook_localecontributions/docs/developer/hooks/core.phpAllows modules to define their own text groups that can be translated.
hook_mailcontributions/docs/developer/hooks/core.phpPrepare a message based on parameters. @see drupal_mail for more.
hook_mail_altercontributions/docs/developer/hooks/core.phpAlter 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_menucontributions/docs/developer/hooks/core.phpDefine menu items and page callbacks.
hook_menu_altercontributions/docs/developer/hooks/core.phpAlter the data being saved to the {menu_router} table after hook_menu is invoked.
hook_menu_link_altercontributions/docs/developer/hooks/core.phpAlter the data being saved to the {menu_links} table by menu_link_save().
hook_modules_disabledcontributions/docs/developer/hooks/core.phpPerform necessary actions after modules are disabled.
hook_modules_enabledcontributions/docs/developer/hooks/core.phpPerform necessary actions after modules are enabled.
hook_modules_installedcontributions/docs/developer/hooks/core.phpPerform necessary actions after modules are installed.
hook_modules_uninstalledcontributions/docs/developer/hooks/core.phpPerform necessary actions after modules are uninstalled.
hook_nodeapicontributions/docs/developer/hooks/core.phpAct on nodes defined by other modules.
hook_node_access_recordscontributions/docs/developer/hooks/core.phpSet permissions for a node to be written to the database.
hook_node_grantscontributions/docs/developer/hooks/core.phpInform the node access system what permissions the user has.
hook_node_infocontributions/docs/developer/hooks/node.phpDefine module-provided node types.
hook_node_operationscontributions/docs/developer/hooks/core.phpAdd mass node operations.
hook_node_typecontributions/docs/developer/hooks/node.phpAct on node type changes.
hook_permcontributions/docs/developer/hooks/core.phpDefine user permissions.
hook_pingcontributions/docs/developer/hooks/core.phpPing another server.
hook_preparecontributions/docs/developer/hooks/node.phpThis 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_altercontributions/docs/developer/hooks/core.phpPerform alterations profile items before they are rendered. You may omit/add/re-sort/re-categorize, etc.
hook_requirementscontributions/docs/developer/hooks/install.phpCheck installation requirements and do status reporting.
hook_schemacontributions/docs/developer/hooks/install.phpDefine the current version of the database schema.
hook_schema_altercontributions/docs/developer/hooks/core.phpPerform alterations to existing database schemas.
hook_searchcontributions/docs/developer/hooks/core.phpDefine a custom search routine.
hook_search_preprocesscontributions/docs/developer/hooks/core.phpPreprocess text for the search index.
hook_system_info_altercontributions/docs/developer/hooks/core.phpAlter the information parsed from module and theme .info files
hook_taxonomy_term_deletecontributions/docs/developer/hooks/core.phpRespond to the deletion of taxonomy terms.
hook_taxonomy_term_insertcontributions/docs/developer/hooks/core.phpAct on taxonomy terms when inserted.
hook_taxonomy_term_loadcontributions/docs/developer/hooks/core.phpAct on taxonomy terms when loaded.
hook_taxonomy_term_updatecontributions/docs/developer/hooks/core.phpAct on taxonomy terms when updated.
hook_taxonomy_vocabulary_deletecontributions/docs/developer/hooks/core.phpRespond to the deletion of taxonomy vocabularies.
hook_taxonomy_vocabulary_insertcontributions/docs/developer/hooks/core.phpAct on taxonomy vocabularies when inserted.
hook_taxonomy_vocabulary_loadcontributions/docs/developer/hooks/core.phpAct on taxonomy vocabularies when loaded.
hook_term_pathcontributions/docs/developer/hooks/core.phpAllows modules to provide an alternative path for the terms it manages.
hook_themecontributions/docs/developer/hooks/core.phpRegister a module (or theme's) theme implementations.
hook_theme_registry_altercontributions/docs/developer/hooks/core.phpAlter the theme registry information returned from hook_theme().
hook_translated_menu_link_altercontributions/docs/developer/hooks/core.phpAlter a menu link after it's translated, but before it's rendered.
hook_uninstallcontributions/docs/developer/hooks/install.phpRemove any information that the module sets.
hook_updatecontributions/docs/developer/hooks/node.phpRespond to node updating.
hook_update_indexcontributions/docs/developer/hooks/core.phpUpdate Drupal's full-text index for this module.
hook_update_Ncontributions/docs/developer/hooks/install.phpPerform 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_update_status_altercontributions/docs/developer/hooks/core.phpAlter the information about available updates for projects.
hook_usercontributions/docs/developer/hooks/core.phpAct on user account actions.
hook_user_operationscontributions/docs/developer/hooks/core.phpAdd mass user operations.
hook_validatecontributions/docs/developer/hooks/node.phpVerify a node editing form.
hook_viewcontributions/docs/developer/hooks/node.phpDisplay a node.
hook_watchdogcontributions/docs/developer/hooks/core.phpLog an event message
hook_xmlrpccontributions/docs/developer/hooks/core.phpRegister XML-RPC callbacks.
module_hookdrupal/includes/module.incDetermine whether a module implements a hook.
module_implementsdrupal/includes/module.incDetermine which modules are implementing a hook.
module_invokedrupal/includes/module.incInvoke a hook in a particular module.
module_invoke_alldrupal/includes/module.incInvoke a hook in all enabled modules that implement it.
_module_implements_maintenancedrupal/includes/module.incThis is the maintenance version of module_implements for internal use only.