A class to manage hooks, and to call hook handlers.
This class is capable of managing a flexible list of hooks, registering handlers for those hooks, and calling the handlers and/or related events.
package |
CMS |
---|---|
license |
GPL |
since | 2.2 |
author |
Robert Campbell calguy1000@gmail.com |
add_hook(string $name, callable $callable, integer $priority = self::PRIORITY_NORMAL)
string
$nameThe hook name. If the hook does not already exist, it is added.
callable
$callableA callable function, or a string representing a callable function. Closures are also supported.
integer
$priorityThe priority of the handler.
in_hook(null|string $name = null) : boolean
null|string
$nameThe hook name to test for. If null is provided, the system will return true if any hook is being processed.
boolean
do_hook() : mixed
This method accepts variable arguments. The first argument (required) is the name of the hook to execute. Further arguments will be passed to the various handlers.
mixed
The output of this method depends on the hook.
do_hook_accumulate() : array
This method accepts variable arguments. The first argument (required) is the name of the hook to execute. Further arguments will be passed to the various handlers.
array
PRIORITY_HIGH
PRIORITY_NORMAL
PRIORITY_LOW