[development] hook_nodeapi()

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


On 1/3/07, Karoly Negyesi <karoly at negyesi.net> wrote:
>
> (Can't remember at 1am whether 4.7 had this already but 5.0 has it for
> sure)


Not going to let you go easy. This is about lunchtime for you ;-)

Compare its behaviour with hook_menu , hook_form_alter etc. Here, we iterate
> the modules that implement the hook. An arbitrary number of modules will be
> called. 'hook' is replaced with the implementing module name.
>
> I would kindly suggest steering the discussion towards better naming of
> hook_load & co. 'Callbacks with a predefined prefix' somewhat does not sound
> spiffy.



Thanks for the explanation.

The point remains though that from a module developer point of view, they
look the same.
What Drupal does with them may be different, but as far as my module is
concerned, they
are points of call from Drupal to the module, and they overlap often.

For the rename you are proposing, would something like this work?

- 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.

How about that?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070103/10fb5847/attachment.htm 


More information about the development mailing list