[development] hook_nodeapi()

Khalid B kb at 2bits.com
Thu Jan 4 01:19:33 UTC 2007


Suggestion 4 is interesting, and seems to be a viable solution too.

The biggest disadvantage of this (which is quite obvious from looking
> at the above example) is that it will be difficult to say when a
> module should or shouldn't assume ownership of node types, and that it
> will be easy for multiple modules to all assume ownership of node
> types, which would basically render the ordering of the hooks
> redundant (since none of them choose to use 'alter').


Agreed.

Moreover, if event module is pointing to CCK, then who owns the node
type? CCK or event?

Suggestion 5 builds on what Karoly said, which I am summarizing below.

- move all hook_load() and friends into hook_othernodeapi($op), where $op is
load, insert,
delete, ...etc.
- So, we have one real hook (hook_nodeapi($op)), and one callback
(hook_othernodeapi($op)).

(of course, othernodeapi has to be something better)

This has the advantage of having only a maximum of two functions per module,
with ops of course.
One for node creation modules, and the other the regular nodeapi we know
today.

Your suggestion (#4) has the advantage of collapsing everything in one
hook_nodeapi() though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070103/3d4bdf20/attachment.htm 


More information about the development mailing list