[development] hook_nodeapi()

Rob Barreca rob at electronicinsight.com
Thu Jan 4 01:24:13 UTC 2007


> 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)
Good point Khalid. That type of consolidation would clear it up from a 
new developer's point of view. I think that has been a big part of the 
confusion that nodeapi is a mutli-function hook, while 
hook_insert/update/delete are separate. I think this is a good 
intermediary step.

AFAICT we're going to need some type of hook ordering/weighting like chx 
is proposing. But, I guess that is farther down the line and I should 
just shut up until that system comes to the forefront and we can analyze 
if there is any further simplification needed then.

Rob Roy Barreca
Founder and COO
Electronic Insight Corporation
http://www.electronicinsight.com
rob at electronicinsight.com



Khalid B wrote:
> On 1/3/07, *Karoly Negyesi* <karoly at negyesi.net 
> <mailto: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/c90dde15/attachment.htm 


More information about the development mailing list