[development] Giving form_alter an $op and calling it more than
chris at tinpixel.com
Tue Apr 18 15:42:31 UTC 2006
Karoly Negyesi wrote:
>>> Back to the point: What if we re-do the lifecycle of a node ins the form
>>> 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)
Would I be all wet to suggest the following as a thought exercise?
In the name of performance, as well as to enable ordering and repeat
callbacks, a lot more sophistication and work could be done at module enable time.
What if, instead of "call module hook if it exists" calls, we built an ordered
list of callbacks for each hook at module enable time, and did our hook calls
by walking that list (graph)? Enabling a module would add its hooks to lists
stored in a compact, high-performance format in a cache / db table. Callbacks
would walk those lists. Necessary enable logic would allow module to place
itself in a list more than once if needed for re-invoking / roundtrip scenarios.
This might even improve bootstrap performance.
Does such a scheme help? Or have I missed some crucial point? :-/
More information about the development