[development] Giving form_alter an $op and calling it more than once.

Bèr Kessels ber at webschuur.com
Tue Apr 18 08:33:12 UTC 2006

Op dinsdag 18 april 2006 01:01, schreef Robert Douglass:
> One aspect of the FAPI drives me mad:
> The only way to get this to work is by tweaking the weight in the system
> table. Yuck.

Yes, I was unpeasantly surprised by this rough edge, too.

> There is no way that we will ever resolve all the ordering problems with
> our hook based system--- they plague every hook we have.
> --BUT--
> Other hooks have help by passing an $op and calling the hook more than
> once. Perhaps form_alter needs an $op { 'add', 'process' }. Or we need
> two hooks:
> hook_form_additions
> hook_form_alter
> I predict that the ordering problem in form_alter will become acute very
> soon. Many people are just waking up to the possibilities the new FAPI
> holds.

IMO we should look into two new directions. This will a) bring us closer to 
(emulating) OOP and b) allow us better control in all places.

* roundtrip calls (or any other names): A hook returns roundtrip = TRUE if it 
wants the hook to be invoked again. mymodule_load() adds something and sets 
roundtrip = TRUE. node_load() would be re-invoked completely, but now with 
the additioanl info injected by mymodule_load() 

* (re) define all the messages that an Object in OOP has. We could/should have 
hook calls for each and every one of them. Examples: init load create read 
update insert delete ... Then we make sure that drupal calls ALL these $ops 
for ANY hook, at ALL times. This wll make hooks more consistent across 
Drupal, give us a central place to cache/improve/change hooks and so on. 

Both are big tasks, but if we want to proceed forward, I think this bumb needs 
to be taken. Drupal is not OOP for a good reason, but that doe not mean we 
should not take some good parts from OOP and implement them. 

Weighting modules does not cut it. In fact, I dislike that weighting, because 
I see it as a hack, that will hold us back from getting 'real' improvemets to 
the hook system done. Simply because we can now say 'this is not needed, 
because you can use the weight hack', these improvements are not 'itching' 
enough anymore.

[ End user Drupal services and hosting | Sympal.nl ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20060418/1f6feeb4/attachment.pgp

More information about the development mailing list