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

Karoly Negyesi karoly at negyesi.net
Tue Apr 18 12:56:56 UTC 2006


>> Back to the point: What if we re-do the lifecycle of a node ins the form
>> system?
>> That would mean you have form_alter($op) with:
>> $op = load (collecting the form, change)
>> $op = view (theming, changing the behaviour, reordering and so)
>> $op = insert (data is inserted)
>> $op = validate (valdation)

Not a good idea. form_alter has nothing to do with "view" or "insert". If  
you want form_alter ordering then do form_alter ordering.
Phases:

a) Calling form_alter with $op, let's say "collect". Returned are  
information "I want to be called after X".
b) build a directed graph out of it.
c) create a walk.

> I think that syntax is a bit inconsistent with form api, but the idea is
> right on. I'll work on a patch for 4.8 (if noone beats me to it) that  
> gets of the insert/update/validate ops of nodeapi. They will be replaced  
> with
> #submit and $#validate handlers.

This actually has nothing to do with form_alter but yes, this direction is  
natural.

Btw. the http://api.drupal.org/api/head/function/hook_nodeapi speaks about  
'execute' instead of 'submit', someone plz correct it.


More information about the development mailing list