After the suggestion of "module" ordering for hook certain, I thought a bit and conclude that the problem is that we have some "events" missing. Let's make a resume: * hook_load() is called for the specific module that implements that node type (only after 4.7 it was implemented a nice way to have multiple node types inside a unique module) * hook_nodeapi('load') is called *after* a node is loaded (are you seeing the problem?) We need more events, and with correct names for nodeapi: * load - called only for the modules that implement the specific node types. If "example.module" implements a node "xpto" that, then nodeapi('load') will only be called for this module, because it knows that is "example.module" that has "xpto" node type * after load - called for every other module, after the 'load' was done and allowing the altering and adjustment of the already loaded fields * insert * after insert * update * after update * delete * after delete Are you seeing what we can do here? Funny, we can add a "before *event*" allowing us to do things before anything is done. What do you think? On 1/3/07, Karoly Negyesi <karoly@negyesi.net> wrote:
Hi,
Reading the hook_nodeapi thread...
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, weight.php . It's trivial to extend this capatibility to packages as well, so that if you ask to be run before !views then you will run before all modules that belong to the views package.
All nice and dandy. But, the next step would be to request for "I want to be the first for hook_foo". What am I to do if two module asks for this? Die a horrible death? Disable the offending modules? This code, quite obviously will run on the modules page.
Regards
NK
Ps. Extending hook registry to hook#op is also in the plans.