Hello, I'm Mahesh

An interactive web developer on Drupal & WordPress

Commonly used hooks in Drupal 7

Drupal is based on Hook system by which it interacts with modules. The modules interact with the core using hooks and add their own features or alter the existing features. Here are the commonly used hooks that are used in Drupal programming often.

Block related hooks

hook_block_info Define all blocks provided by the module.
hook_block_info_alter Change block definition before saving to the database.Change block definition before saving to the database.
hook_block_configure Define a configuration form for a block.
hook_block_save Save the configuration options from hook_block_configure().
hook_block_view Return a rendered or renderable view of a block.
hook_block_view_alter Perform alterations to the content of a block.
hook_block_view_MODULE_DELTA_alter Perform alterations to a specific block.

Cron Related Hooks

hook_cron Perform periodic actions.
hook_cron_queue_info Declare queues holding items that need to be run periodically
hook_cron_queue_info_alter Alter cron queue information before cron runs.

Node related Hooks

hook_delete Respond to node deletion.
hook_form Display a node editing form.
hook_insert Respond to creation of a new node.
hook_load Act on nodes being loaded from the database.
hook_node_info Define module-provided node types.
hook_update Respond to updates to a node.

Installation related Hooks

hook_install Perform setup tasks when the module is installed.
hook_schema Define the current version of the database schema.
hook_schema_alter Perform alterations to existing database schemas.
hook_uninstall Remove any information that the module sets.
hook_update_N Perform a single update.

Help related Hooks

hook_help Provide online user help.

Permission related Hooks

hook_permission Define user permissions.

Menu related Hooks

hook_menu Define menu items and page callbacks.
hook_menu_alter Alter the data being saved to the {menu_router} table after hook_menu is invoked.

Form related Hooks

hook_form_alter Perform alterations before a form is rendered.
hook_form_BASE_FORM_ID_alter Provide a form-specific alteration for shared (‘base’) forms.
hook_form_FORM_ID_alter Provide a form-specific alteration instead of the global hook_form_alter().

Theme related Hooks

hook_theme Register a module (or theme’s) theme implementations.
hook_theme_registry_alter Alter the theme registry information returned from hook_theme().

 

Leave a Reply