[development] hook_foo() vs. nodeapi

Jonathan Chaffer jchaffer at structureinteractive.com
Sat May 6 20:12:01 UTC 2006


On May 6, 2006, at 3:38 PM, Khalid B wrote:

> One thing that bothered me for a while is that we almost
> moved from hook_foo() to  foo_nodeapi(), but never completely
> did so.
>
> In some cases we use foo_view(), in others we have a foo_nodeapi()
> with a switch/case for $op  'view'.

They mean different things.

Use foo_view() if foo.module defines a node type, and wants to define  
its presentation.

Use foo_nodeapi('view') if foo.module doesn't define a node type, but  
wants to alter the presentation of all nodes.

I don't have a big problem with making the API consistent for these,  
but we need to realize that they are not interchangeable as it stands.



More information about the development mailing list