On Sat, 2005-12-03 at 17:31 -0500, Jonah Bossewitch wrote:
This is the same problem I encountered back in
December when I tried
using the hooks to insert extra information into the template's context
Thanks for reporting the problem; that's one of the reasons it's been
fixed.
In that email, I suggested using a named array rather
than a simple
array to pass the parameters. Do you think this might provide more
clarity?
It's a good idea, but I don't think it'll improve clarity. I think the
current format is easier to write and read than having named params.
Viz:
# current
wfRunHooks('Event', array($param1, &$param2, $param3));
# ...
function MyHookFunction($param1, &$param2, $param3) {
$param2 = $param1 + $param3;
return true;
}
versus
# proposed
wfRunHooks('Event',
array('param1' => $param1, 'param2' => &$param2,
'param3' => $param3));
# ...
function MyHookFunction($args) {
$args['param2'] = $args['param1'] + $args['param3'];
return true;
}
I also don't think that named-arg passing makes defining the event
parameters any simpler; you just have to look up the names of the
parameters rather than their position. Either way, there's a
documentation requirement that won't go away.
And wfRunHooks() itself would be slightly more complicated.
Also, what about including this actual setupTemplate
processing hook
that I proposed?
I'll try to get to it, but it's a separate issue. I'd also like to set
output events at a really fine grain.
~Evan
--
Evan Prodromou
evan(a)bad.dynu.ca