addListener()
fire()
getEventListeners()
removeListeners()
setListeners()
__construct()
$_listeners
Fires code events and executes event listener callbacks.
package | XenForo_CodeEvents |
---|
addListener(string $event, callback $callback)
This method takes an arbitrary callback, so can be used with more advanced things like object-based callbacks (and simple function-only callbacks).
string
Event to listen to
callback
Function/method to call.
fire(string $event, array $args) : boolean
The listener may return false, which will prevent any further listeners from running and cause this function (fire) to return false. This indicates that the listener handled the job the built-in code was going to do and if applicable, the built-in code need not run. (This will only apply in limited circumstances.)
Note that if you want to allow arguments to be modified, they must be passed by reference. Eg: array($value, &$reference) If you do this, the receiving function will always be given the arguments by reference!
string
Name of the event to first
array
List of arguments to pass to the callback. If you want to make something modifiable, you must pass it by reference to the array.
boolean
getEventListeners(string $event) : array | false
string
array
false
List of listener callbacks or falseremoveListeners()
setListeners(array $listeners, boolean $keepExisting)
array
Format: [event id][] => callback
boolean
__construct()
$_listeners : array