[development] Convention for naming contrib hooks?

larry at garfieldtech.com larry at garfieldtech.com
Thu Oct 15 17:57:09 UTC 2009


There's no central canonical list, since hooks are fairly free-form. 
It's generally good practice to prefix a hook with the name of your 
module if you're not a core module (hook_yourmodulenamehere_hookname()), 
but that's not universal unfortunately.

--Larry Garfield

arthur wrote:
> Hi-
> 
> Forgive me if this question is answered elsewhere- I've not found a 
> comprehensive answer thus far.
> 
> With contrib modules sprawling ever more, it's extremely hard to keep 
> track of what modules implement what kinds of hooks. For example, I got 
> caught by file_field's hook_file_delete() when I implemented 
> media_mover_api_file_delete() which had nothing to do with this hook. 
> While I renamed my function, it's challenging at best to know the 
> terrain. Is there a central place where contrib developers can list 
> their hooks, or a naming convention that is agreed to that would help 
> with this (eg: hook_HOOKNAME_HOOKMODULE() or something)?
> 
> thanks,
> 
> arthur


More information about the development mailing list