[development] Hook ordering

Karoly Negyesi karoly at negyesi.net
Fri Jan 5 22:54:54 UTC 2007


> * why do have we to use both?

Because http://drupal.org/node/50627 got little love. We are not perfect. Working on it though.

> * if one will stand up, what will be?

Both will stand up.

> Now, as I can see what you want is remove "nodeapi" stuff and convert
> it for the hook_node_foo naming scheme. Nice, I'll help you with that:
> * hook_load -> hook_node_load($when)
> * hook_insert -> hook_node_insert($when)
> * hook_nodeapi(op) -> hook_node_op($when)
> * etc, etc, etc

Still no.

If teddy.module implements a node type then teddy_load remains. Just I am trying to find a better name to call this, because the hook part of hook_load does not really fit. As said, functor came to my mind -- functor_load. Might be a bad idea. Do not know yet. It took me five years to get a good translation in Hungarian for the word 'bully'... Reason for this change: hook is something that is called by module_invoke_all or similar. Code change: zero. This is a documentation change.

But, if event module wants to add events to teddy nodes then it currently acts on hook_nodeapi op load. It's a true hook. Currently I think we would be better off calling this hook_node_load. Reason for this change: easier to fit into hook registry/order system. But then again -- hook_nodeapi#load could also be ordered. Just feel clumsy. Code change: for more complex modules, extremely little -- they have their handlers for different ops in different functions already.

If you want to further this discussion then give me reasons why your change is better than the current, nice, orthogonal system. I am not changing the system at all, just renaming stuff a little bit. 


More information about the development mailing list