[support] still on inter module communication and workflow

Ivan Sergio Borgonovo mail at webthatworks.it
Sun Jan 4 15:47:08 UTC 2009


I'm working on D5.

I just discovered my error with the static variable approach.

If I call a function with a static during "content creation" (the
function that is declared in the menu hook in items[]=>'callback'),
it is true that the menu hook of a module with lower weight will be
called first but it's not true that the functions will be called
first.

So while hook processing can be prioritised... the page creation
work-flow seems to be divided in just 3 steps

hook_init
callback function in menu
template processing

D6 makes more "accessible" the later with
[hook]_preprocess_[element]

but the page creation process from a module point of view is quite
"monolithic".

Supposing "mymodule" want to offer some sort of HEAD/META facility
only way I see to collect information from other modules and then
output them on page after all the modules had a chance to fill some
global object (at th function level rather than at the module level)
is to call a function in the template.

Offering this global object as a hook will not introduce a
dependency in the modules that may be willing to *optionally* support
'mymodule' but well offering it as a hook will be just another way
to wrap it with a function_exists since I'd have to wrap the
"output" function in the template anyway.

Is there any other way to approach the problem in D5?
Did I miss something about the page build up work-flow?
Can it be more fine grained splitted (in D5, D6 or D7)? or are there
any places/hook/method... to have code executed in a certain order
I don't mean triggers/actions. They seems more linked to list of
events rather than their execution time.

thanks

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it



More information about the support mailing list