[development] Hook ordering
karoly at negyesi.net
Wed Jan 3 23:06:39 UTC 2007
----- Start Original Message -----
Sent: Wed, 03 Jan 2007 16:52:45 -0600
From: Scott McLewin <drupal at mclewin.com>
To: development at drupal.org
Subject: Re: [development] Hook ordering
> Karoly Negyesi wrote:
> > In Drupal 6 I would like to see a hook registry -- mostly
> > autodiscovered, but if you want ordering, then you can say "my
> > implementation of hook_nodeapi is to be run before module
> > this,that,foor,bar". Available in my sandbox,
> I don't know which sandbox is yours and didn't see 'knegyesi', 'negyesi'
> or 'karoly' under
> http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/. So,
> without looking at the code...
I need to work on my reputation :)
> I agree that is a challenge, since the person who picked the 'first'
> ordering may not run with the particular module combination that an
> arbitrary site builder/admin will install. I like the current pattern
> of hook_load() and friends as being 'first' for a module that defines
> its own type. How about leaving that in place and only allowing
> 'before' and 'after' designations in the proposed registry?
hook_load is not a real hook, it's a callback, because at any given time only one is called.
hook_nodeapi is a hook, at any given time all implementations are called in order.
For example, hook_form_alter. What happens when two modules try to be the first? Or the last for that matter?
More information about the development