Hooking into a contrib module I've installed a contrib module in Drupal 7 and would like to hook into it.  However, the documentation for the contrib module is sparse and doesn't list the available hooks, though it implies that there are some.

Is there a standard "Drupal way" of seeing what hooks a contrib module exposes?

(I've deliberately not mentioned which module this is as I'd like a generic answer if one exists.)
By convention a lot of modules include a modulename.api.php file in the root folder, which describes the hooks implemented.

They may also implement hook_hook_info() to programatically describe the hooks to Drupal.

If that file isn't there, have a look at the other documentation/non-code files included. Sometimes you'll find examples elsewhere in the folder structure.

There's nothing enforced, though, so there isn't a generic all-encompassing answer. For a low tech solution you could grep the module folders for patterns like


module_invoke('modulename
module_invoke_all('modulename
module_implements('modulename


If you use the grep method, remember to add a conditional for the quote before the module name, it could be single or double.

In case the above causes confusion:

By convention most hooks are prefixed with the module's name, so that method will work 99% of the time, and avoid false-positives when a module invokes hooks for anything other than itself.

There will be the odd instance when it doesn't, but since there's no formally enforced way for a module to define hooks, anything non-manual here is going to be a best effort however you look at it.