Drupal Hooks

0
Your rating: None

Hooks allow modules to interact with the Drupal core.

Module system of Drupal is based on the concept of "hooks". A hook is actually a PHP
function that is named modulename_hookname(), where "modulename" is the name of the module (whose
filename will be modulename.module) and "hookname" is the name of the hook. Every hook have
a defined set of parameters and a specified result type.

For extending Drupal, your module simply need to 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 in the Hooks section of
the developer documentation of Drupal. 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

Name Location Description
custom_url_rewrite_inbound developer/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 developer/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 developer/hooks/node.php Define access restrictions.
hook_actions_delete developer/hooks/core.php Execute code after an action is deleted.
hook_action_info developer/hooks/core.php Declare information about one or more Drupal actions.
hook_action_info_alter developer/hooks/core.php Alter the actions declared by another module.
hook_block developer/hooks/core.php Declare a block or set of blocks.
hook_boot developer/hooks/core.php Perform setup tasks. See also, hook_init.
hook_comment developer/hooks/core.php Act on comments.
hook_cron developer/hooks/core.php Perform periodic actions.
hook_db_rewrite_sql developer/hooks/core.php Rewrite database queries, usually for access control.
hook_delete developer/hooks/node.php Respond to node deletion.
hook_disable developer/hooks/install.php Perform necessary actions before module is disabled.
hook_elements developer/hooks/core.php Allows modules to declare their own Forms API element types and specify their
default values.
hook_enable developer/hooks/install.php Perform necessary actions after module is enabled.
hook_exit developer/hooks/core.php Perform cleanup tasks.
hook_file_download developer/hooks/core.php Control access to private file downloads and specify HTTP headers.
hook_filter developer/hooks/core.php Define content filters.
hook_filter_tips developer/hooks/core.php Provide tips for using filters.
hook_flush_caches developer/hooks/core.php Add a list of cache tables to be cleared.
hook_footer developer/hooks/core.php Insert closing HTML.
hook_form developer/hooks/node.php Display a node editing form.
hook_forms developer/hooks/core.php Map form_ids to builder functions.
hook_form_alter developer/hooks/core.php Perform alterations before a form is rendered.
hook_form_FORM_ID_alter developer/hooks/core.php Provide a form-specific alteration instead of the global hook_form_alter().
hook_help developer/hooks/core.php Provide online user help.
hook_hook_info developer/hooks/core.php Expose a list of triggers (events) that your module is allowing users to
assign actions to.
hook_init developer/hooks/core.php Perform setup tasks. See also, hook_boot.
hook_insert developer/hooks/node.php Respond to node insertion.
hook_install developer/hooks/install.php Install the current version of the database schema, and any other setup tasks.
hook_link developer/hooks/core.php Define internal Drupal links.
hook_link_alter developer/hooks/core.php Perform alterations before links on a node are rendered.
hook_load developer/hooks/node.php Load node-type-specific information.
hook_locale developer/hooks/core.php Allows modules to define their own text groups that can be translated.
hook_mail developer/hooks/core.php Prepare a message based on parameters. @see drupal_mail for more.
hook_mail_alter developer/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 developer/hooks/core.php Define menu items and page callbacks.
hook_menu_alter developer/hooks/core.php Alter the data being saved to the {menu_router} table after hook_menu is invoked.
hook_menu_link_alter developer/hooks/core.php Alter the data being saved to the {menu_links} table by menu_link_save().
hook_nodeapi developer/hooks/core.php Act on nodes defined by other modules.
hook_node_access_records developer/hooks/core.php Set permissions for a node to be written to the database.
hook_node_grants developer/hooks/core.php Inform the node access system what permissions the user has.
hook_node_info developer/hooks/node.php Define module-provided node types.
hook_node_operations developer/hooks/core.php Add mass node operations.
hook_node_type developer/hooks/node.php Act on node type changes.
hook_perm developer/hooks/core.php Define user permissions.
hook_ping developer/hooks/core.php Ping another server.
hook_prepare developer/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 developer/hooks/core.php Perform alterations profile items before they are rendered. You may omit/add/re-sort/re-categorize, etc.
hook_requirements developer/hooks/install.php Check installation requirements and do status reporting.
hook_schema developer/hooks/install.php Define the current version of the database schema.
hook_schema_alter developer/hooks/core.php Perform alterations to existing database schemas.
hook_search developer/hooks/core.php Define a custom search routine.
hook_search_preprocess developer/hooks/core.php Preprocess text for the search index.
hook_system_info_alter developer/hooks/core.php Alter the information parsed from module and theme .info files
hook_taxonomy developer/hooks/core.php Act on taxonomy changes.
hook_term_path developer/hooks/core.php Allows modules to provide an alternative path for the terms it manages.
hook_theme developer/hooks/core.php Register a module (or theme's) theme implementations.
hook_theme_registry_alter developer/hooks/core.php Alter the theme registry information returned from hook_theme().
hook_translated_menu_link_alter developer/hooks/core.php Alter a menu link after it's translated, but before it's rendered.
hook_translation_link_alter developer/hooks/core.php Perform alterations on translation links.
hook_uninstall developer/hooks/install.php Remove any tables or variables that the module sets.
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_update_last_removed developer/hooks/install.php Return a number which is no longer available as hook_update_N().
hook_update_N developer/hooks/install.php Perform a single update.
hook_update_status_alter developer/hooks/core.php Alter the information about available updates for projects.
hook_user developer/hooks/core.php Act on user account actions.
hook_user_operations developer/hooks/core.php Add mass user operations.
hook_validate developer/hooks/node.php Verify a node editing form.
hook_view developer/hooks/node.php Display a node.
hook_watchdog developer/hooks/core.php Log an event message
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.

The complete information is collected from Drupal site,you are highly requested to refer
http://api.drupal.org/api/group/hooks for a detail list of hooks available.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.

Cumulus Tag Cloud

Kiran Says

I love work environment which is:

Informal yet professional
Demanding yet rewarding
Challenging yet inspiring
Mediocrity is not an option
Having fun is serious business
Making mistakes is human
Forgiveness is Company Policy

Travelling Sucks