core/Event – Kohana API 2.3 Documentation

system/core/Event.php

Class: Event

final class Event

Process queuing/execution class. Allows an unlimited number of callbacks to be added to 'events'. Events can be run multiple times, and can also process event-specific data. By default, Kohana has several system events.


Methods

Event :: add

public static function add

Add a callback to an event queue.

Parameters:

string name
event name
array callback
http://php.net/callback

Return: boolean


Event :: add_before

public static function add_before

Add a callback to an event queue, before a given event.

Parameters:

string name
event name
array existing
existing event callback
array callback
event callback

Return: boolean


Event :: add_after

public static function add_after

Add a callback to an event queue, after a given event.

Parameters:

string name
event name
array existing
existing event callback
array callback
event callback

Return: boolean


Event :: insert_event

private static function insert_event

Inserts a new event at a specfic key location.

Parameters:

string name
event name
integer key
key to insert new event at
array callback
event callback

Return: void


Event :: replace

public static function replace

Replaces an event with another event.

Parameters:

string name
event name
array existing
event to replace
array callback
new callback

Return: boolean


Event :: get

public static function get

Get all callbacks for an event.

Parameters:

string name
event name

Return: array


Event :: clear

public static function clear

Clear some or all callbacks from an event.

Parameters:

string name
event name
array callback
(FALSE) specific callback to remove, FALSE for all callbacks

Return: void


Event :: run

public static function run

Execute all of the callbacks attached to an event.

Parameters:

string name
event name
array data
(NULL) data can be processed as Event::$data by the callbacks

Return: void


Event :: has_run

public static function has_run

Check if a given event has been run.

Parameters:

string name
event name

Return: boolean