17 private $handlers = array();
31 $this->logger = $logger;
44 if (empty(
$name) || empty(
$type) || !is_callable($callback,
true)) {
48 if (!isset($this->handlers[
$name])) {
49 $this->handlers[
$name] = array();
52 if (!isset($this->handlers[$name][
$type])) {
59 while (isset($this->handlers[$name][$type][$priority])) {
64 ksort($this->handlers[$name][$type]);
80 if (isset($this->handlers[
$name]) && isset($this->handlers[$name][
$type])) {
81 foreach ($this->handlers[$name][$type] as
$key => $name_callback) {
82 if ($name_callback == $callback) {
83 unset($this->handlers[$name][$type][
$key]);
104 return $this->handlers;
132 if (
$name !=
'all' && $type !=
'all') {
133 $handlers = array_merge($handlers, array_values($this->handlers[
$name][$type]));
136 if (isset($this->handlers[
'all'][$type])) {
137 if ($type !=
'all') {
138 $handlers = array_merge($handlers, array_values($this->handlers[
'all'][$type]));
141 if (isset($this->handlers[
$name][
'all'])) {
142 if ($name !=
'all') {
143 $handlers = array_merge($handlers, array_values($this->handlers[$name][
'all']));
146 if (isset($this->handlers[
'all'][
'all'])) {
147 $handlers = array_merge($handlers, array_values($this->handlers[
'all'][
'all']));
hasHandler($name, $type)
Does the hook have a handler?
setLogger(\Elgg\Logger $logger=null)
Set a logger instance, e.g.
if($guid==elgg_get_logged_in_user_guid()) $name
registerHandler($name, $type, $callback, $priority=500)
Registers a handler.
getAllHandlers()
Returns all registered handlers as array( $name => array( $type => array( $priority => callback...
unregisterHandler($name, $type, $callback)
Unregister a handler.
getOrderedHandlers($name, $type)
Returns an ordered array of handlers registered for $name and $type.