[development] hook_foo() vs. nodeapi
Khalid B
kb at 2bits.com
Sat May 6 20:18:27 UTC 2006
If the module defines a node type, we can still use nodeapi('view'), and
check $node->type = 'mytype' and do whatever we would do in the
mytype_view() hook.
Or am I missing something?
On 5/6/06, Jonathan Chaffer <jchaffer at structureinteractive.com> wrote:
> 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