Re: Module hooks/calling a specific hook
"Sean Brook" <sean_brook-/[email protected]> Sat, 23 Aug 2003 20:27:38 +0100
| Newsgroups | gmane.comp.cms.xaraya.knowledge-base |
|---|---|
| Organization | Xaraya News Server |
| Message-ID | <[email protected]> |
Just check if an expected hook exists (with xarModIsHooked) and if it does
call the hooked function directly.
eg. in mymodule
...
$hooks = array();
if(xarModIsHooked('ratings', 'mymodule'))
{
// the xarModFunc call here is from xarModCallHooks. An API call would
take the same arguments.
$hooks['ratings'] = xarModFunc('ratings',
'user',
'display',
array('objectid' => $itemid,
'extrainfo' =>
xarModURL('mymodule',
'user',
'display',
array('itemid' => $itemid))));
}
"Sean Brook" <[email protected]> wrote in message
news:[email protected]
> In a module I might have more than one hook registered. eg. comments,
> hitcount & ratings.
> Elsewhere when I call the hooks, is it possible to just call one in
> particular? The reason being that at a particular point in the display I
> might want to only display ratings.
>
> - I realise that xarModCallHooks returns an assoc array with keys of
called
> hooks and that I can assign the key for the hooked output that I want.
> However, what I really want to do is just call one hook as part of getting
> the hook output.
>
>
>