1. Is there any function to retrieve all the hook used by a particular module and also

  2. A function to return all menu links (along with its description) created by a particular module

I looked into module_hook and module_implements but both were used to find whether a particular hook is used in a module. But what I need is vice versa.

I need it because configuration options for a particular module can be easily found by getting menu links in a page as a overview.

  1. No - as you've already discovered, the association is the other way around (i.e. a list of modules against each hook, not a list of hooks against each module). Nothing in Drupal's core needs to know a list of all hooks a module implements, so no such function exists. As there's no requirement for a module to declare which hooks it provides (though they can through hook_hook_info()), such a function would be difficult or impossible to implement reliably.

    If you can trust that all the modules you have installed are well documented, you could write something that looks in the comment block of each function for Implements hook_, and build a list yourself that way. Or you could compile a list of all the hooks you're interested in knowing about, run each of them through module_implements, and build your list.

  2. Assuming by "menu link" you mean a path provided by a module that has the default menu type, and will subsequently appear in a menu automatically, something like this will do it for all modules:

    $menu_items = array();
    foreach (module_implements('menu') as $module) {
      $func = $module . '_menu';
      if (function_exists($func)) {
        foreach ($func() as $router_path => $item) {
          if ($item['type'] == MENU_NORMAL_ITEM) {
            $menu_items[$module][$router_path] = $item['title'];

    That will probably need to be be tweaked for your requirements.

|improve this answer|||||
  • Thanks for the idea of looking in the comment block, that was tricky:) I just want to create a module that is able to describe other modules. Is there anything else you can suggest me? – Pravin Ajaaz Apr 6 '15 at 15:43
  • Very interesting idea, I'm afraid I don't know of anything off the top of my head. I'll have a think and get back to you if anything comes to mind – Clive Apr 6 '15 at 18:55
  • Thanks for your appreciation, I will post a new question based on this idea. If you got something, please guide me. – Pravin Ajaaz Apr 7 '15 at 6:05
  • Posted a new question (drupal.stackexchange.com/questions/154209/…) – Pravin Ajaaz Apr 7 '15 at 6:30

@clive: Thanks for your Ideas. Based on your Ideas I started working on it and now its a full project on drupal.org. I also thought that it might answer the question.

Developer Docs Module page brief description:

Developer Docs is a module specially made for drupal developers (amateur). When a new module is installed, it is hard to find what changes it does unless we look into the code. This module provides an overview of "what it does" without looking into the code.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.