feature requests:
(1)
- give me the list of all hooks (triggered on a page)
- give me the list of modules implementing the given hook

a drupal static variable module_implements should have all this info
so it should be something like: $implementations = &drupal_static('module_implements', array());
$implementations[$hook][$module]

(2)
- give me the list of all hooks

I am not sure how to get this list, but parsing all module.api.php files could be one option

resources:
http://www.lullabot.com/articles/drupal-exposed
http://api.drupal.org/.../module_implements/7

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

fyi, devel's drush command, fn-hook, does 'give me the list of modules implementing the given hook'. others are reasonable requests. meanwhile, look at trace module (pretty old, but a gem) and drupal for firebug.

koglinjg’s picture

FileSize
2.17 KB
119.26 KB

I wrote a small patch for devel that provides a page at devel/hooks that lets your search for a hook and returns a list of module that implement it, sorted by their module weight.

I have tested the patch against 6.27 and 7.3

The patch was made to be applied from your modules directory cd sites/all/modules and then apply the patch with this patch -p0 < /path/to/devel-hooks.patch

I have also attached a screen shot of the page that this patch adds.

moshe weitzman’s picture

Status: Active » Needs work

Needs a Drupal 8 implementation at least. FYI, we already have fn-hook command for drush.

pcambra’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
koglinjg’s picture

FileSize
2.18 KB

Here is a d8 patch.

salvis’s picture

Status: Needs work » Needs review

Will this also find hook_form_BASE_FORM_ID_alter() and hook_form_FORM_ID_alter() implementations when I search for hook_form_alter()?

Let's see what the testbot says...

Status: Needs review » Needs work

The last submitted patch, devel-d8-hook.patch, failed testing.

Pere Orga’s picture

Status: Needs work » Needs review

#5: devel-d8-hook.patch queued for re-testing.

Pere Orga’s picture

Status: Needs review » Needs work

The same patch now passes testing.

But AFAICS this only uses devel_module_hooks(), doesn't give the list of all hooks.
And what the $_SESSION['devel_hook_string'] is for?

koglinjg’s picture

No, but I think I might be able to add something like that. I will look into it this weekend.

willzyx’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Closing for lack of activity. Feel free to reopen if the issue still exists