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_rewritedocs-5/hooks/core.phpcustom_url_rewrite is not a hook. It is a function you can add to settings.php to manage aliases with some code.
hook_accessdocs-5/hooks/node.phpDefine access restrictions.
hook_allocation_infoecommerce-5--4/docs/developer/hooks/ec_receipt.phpRegister allocation types to the receipt system. An allocation is literally an allocation of some money on a receipt (say from a payment gateway) against a transaction.
hook_alloc_allocationecommerce-5--4/docs/developer/hooks/ec_receipt.phptba (example is from store.module)
hook_alloc_build_itemsecommerce-5--4/docs/developer/hooks/ec_receipt.phptba (example is from store.module)
hook_alloc_get_addressecommerce-5--4/docs/developer/hooks/ec_receipt.phpThe allocation object provider returns an appropriate address. Eg. store returns an address from the transaction object.
hook_alloc_get_currencyecommerce-5--4/docs/developer/hooks/ec_receipt.phpThe allocation object provider returns currency. Eg. store returns the currency of the transaction object.
hook_alloc_get_customerecommerce-5--4/docs/developer/hooks/ec_receipt.phpThe allocation object provider returns the customer. Eg. store returns the customer from the transaction object.
hook_alloc_get_customer_namesecommerce-5--4/docs/developer/hooks/ec_receipt.phpThe allocation object provider customer names from an allocation object. Eg. store returns the customers from the transaction object.
hook_alloc_get_invoice_noecommerce-5--4/docs/developer/hooks/ec_receipt.phpThe allocation object provider returns the invoice number of the allocation object. Eg. store returns the invoice number from the transaction object.
hook_alloc_get_itemsecommerce-5--4/docs/developer/hooks/ec_receipt.phpThe allocation object provider returns the items of the allocation object. Eg. store returns the product items from the transaction object.
hook_alloc_get_payment_dataecommerce-5--4/docs/developer/hooks/ec_receipt.phpReturn the payment data of an allocation object. Eg. store returns the data previously assigned in 'set_payment_data'
hook_alloc_get_payment_formecommerce-5--4/docs/developer/hooks/ec_receipt.phpI have no idea how an allocation provide returns a payment form since its not a receipt type - sime
hook_alloc_get_payment_typeecommerce-5--4/docs/developer/hooks/ec_receipt.phpReturn the payment method of an allocation object. Eg. store returns the method assigned in 'set_payment_data'
hook_alloc_get_totalecommerce-5--4/docs/developer/hooks/ec_receipt.phpReturn the total amount for an allocation object. Eg. store returns the total for a transaction.
hook_alloc_loadecommerce-5--4/docs/developer/hooks/ec_receipt.phpLoad an allocation object. Eg. store returns the total for a transaction.
hook_alloc_set_payment_dataecommerce-5--4/docs/developer/hooks/ec_receipt.phpAllows an allocation object provider to assign payment data to its native object. Eg. store assigns payment data to its transaction.
hook_blockdocs-5/hooks/core.phpDeclare a block or set of blocks.
hook_checkoutapiecommerce-5--4/docs/developer/hooks/ec_checkout.phpManipulate the checkout process, including injecting form pages.
hook_commentdocs-5/hooks/core.phpAct on comments.
hook_crondocs-5/hooks/core.phpPerform periodic actions.
hook_customer_get_idecommerce-5--4/docs/developer/hooks/ec_customer.phpReturn a customer which your Customer Type module handles. This may be a customer which e-Commerce has never seen before so you're looking in your external location.
hook_customer_infoecommerce-5--4/docs/developer/hooks/ec_customer.phpGeneral description.
hook_db_rewrite_sqldocs-5/hooks/core.phpAdd 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. Primary...
hook_deletedocs-5/hooks/node.phpRespond to node deletion.
hook_disabledocs-5/hooks/install.phpPerform necessary actions before module is disabled.
hook_elementsdocs-5/hooks/core.phpAllows modules to declare their own form element types and specify their default values.
hook_enabledocs-5/hooks/install.phpPerform necessary actions after module is enabled.
hook_exitdocs-5/hooks/core.phpPerform cleanup tasks.
hook_fieldcck-5--1/field.phpDefine the behavior of a field type.
hook_field_formattercck-5--1/field.phpPrepare an individual item for viewing in a browser.
hook_field_formatter_infocck-5--1/field.phpDeclare information about a formatter.
hook_field_infocck-5--1/field.phpDeclare information about a field type.
hook_field_settingscck-5--1/field.phpHandle the parameters for a field.
hook_file_downloaddocs-5/hooks/core.phpAllow file downloads.
hook_filterdocs-5/hooks/core.phpDefine content filters.
hook_filter_tipsdocs-5/hooks/core.phpProvide tips for using filters.
hook_footerdocs-5/hooks/core.phpInsert closing HTML.
hook_formdocs-5/hooks/node.phpDisplay a node editing form.
hook_formsdocs-5/hooks/core.phpMap form_ids to builder functions.
hook_form_alterdocs-5/hooks/core.phpPerform alterations before a form is rendered.
hook_helpdocs-5/hooks/core.phpProvide online user help.
hook_initdocs-5/hooks/core.phpPerform setup tasks.
hook_insertdocs-5/hooks/node.phpRespond to node insertion.
hook_installdocs-5/hooks/install.phpInstall the current version of the database schema.
hook_linkdocs-5/hooks/core.phpDefine internal Drupal links.
hook_link_alterdocs-5/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_loaddocs-5/hooks/node.phpLoad node-type-specific information.
hook_mail_alterdocs-5/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_menudocs-5/hooks/core.phpDefine menu items and page callbacks.
hook_nodeapidocs-5/hooks/core.phpAct on nodes defined by other modules.
hook_node_access_recordsdocs-5/hooks/core.phpSet permissions for a node to be written to the database.
hook_node_grantsdocs-5/hooks/core.phpInform the node access system what permissions the user has.
hook_node_infodocs-5/hooks/node.phpDefine module-provided node types.
hook_node_operationsdocs-5/hooks/core.phpAdd mass node operations.
hook_node_typedocs-5/hooks/node.phpAct on node type changes.
hook_permdocs-5/hooks/core.phpDefine user permissions.
hook_pingdocs-5/hooks/core.phpPing another server.
hook_preparedocs-5/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_alterdocs-5/hooks/core.phpPerform alterations profile items before they are rendered. You may omit/add/re-sort/re-categorize, etc.
hook_receipt_infoecommerce-5--4/docs/developer/hooks/ec_receipt.phpRegister payments gateways to the e-Commerce Receipts system
hook_receipt_loadecommerce-5--4/docs/developer/hooks/ec_receipt.phpLoad additional receipt information from the database.
hook_receipt_payment_formecommerce-5--4/docs/developer/hooks/ec_receipt.phpBuild a form for collecting the payment information.
hook_receipt_payment_urlecommerce-5--4/docs/developer/hooks/ec_receipt.php
hook_receipt_process_paymentecommerce-5--4/docs/developer/hooks/ec_receipt.phpUsing the information past from the payment form the system will process the payment and update the receipt.
hook_receipt_saveecommerce-5--4/docs/developer/hooks/ec_receipt.phpSave additional information about the receipt to the database.
hook_requirementsdocs-5/hooks/install.phpCheck installation requirements that need to be satisfied.
hook_searchdocs-5/hooks/core.phpDefine a custom search routine.
hook_search_preprocessdocs-5/hooks/core.phpPreprocess text for the search index.
hook_submitdocs-5/hooks/node.phpThis 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_taxonomydocs-5/hooks/core.phpAct on taxonomy changes.
hook_uninstalldocs-5/hooks/install.phpRemove any tables or variables that the module sets.
hook_updatedocs-5/hooks/node.phpRespond to node updating.
hook_update_indexdocs-5/hooks/core.phpUpdate Drupal's full-text index for this module.
hook_update_Ndocs-5/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_userdocs-5/hooks/core.phpAct on user account actions.
hook_user_operationsdocs-5/hooks/core.phpAdd mass user operations.
hook_validatedocs-5/hooks/node.phpVerify a node editing form.
hook_viewdocs-5/hooks/node.phpDisplay a node.
hook_widgetcck-5--1/field.phpDefine the behavior of a widget.
hook_widget_infocck-5--1/field.phpDeclare information about a widget.
hook_widget_settingscck-5--1/field.phpHandle the parameters for a widget.
hook_xmlrpcdocs-5/hooks/core.phpRegister XML-RPC callbacks.
hook_xyzecommerce-5--4/docs/developer/hooks/ec_customer.phpGeneral description.
module_hookdrupal-5/includes/module.incDetermine whether a module implements a hook.
module_implementsdrupal-5/includes/module.incDetermine which modules are implementing a hook.
module_invokedrupal-5/includes/module.incInvoke a hook in a particular module.
module_invoke_alldrupal-5/includes/module.incInvoke a hook in all enabled modules that implement it.