New Drupal Module: Available Hooks

May 02, 2017 posted by Yogesh Kumar Khushwaha under CMS

Download Module
New Drupal Module Available Hooks

Challenge
Hooks refer to interaction of modules with the core code of Drupal. It is possible for a module to define new urls and pages within the site (hook_menu), to add content to pages (hook_block, hook_footer, etc.), to set up custom database tables (hook_schema). There are hooks provided by core; additionally, the modules can define their own hooks as well. 

For example, hooks are defined in module_name.api.php file but it is difficult to search a required hook from a file. Alternatively, you can search it on the Internet, but you should know the name of hook, only then can you find the hook that meets your requirement.

Both, searching for a hook in a module_name.api.php file and on the Internet are difficult and time consuming. Internet search will return most common hooks only but in some cases you may search for an uncommon hook which works will with your development needs. 

Solution
I have written a module that reads the module_name.api.php and caches the output in Drupal cache bin so that next time when a user searches for hooks again from the same module, then Drupal will return it from cache and not read the complete file again. Additionally, a list is prepared automatically containing details of all hooks provided by core and contributed/custom modules that are currently installed on project. It shows individual hooks with code implementation. 

Benefits
This module gives proper information about hooks provided by other installed modules and saves time. 

Category

Share this: