Class Core_Event
Event system adds function calls for extending functionality.
Package: HostCMS\Core
Copyright:
© 2005-2021 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru
Author:
Hostmake LLC
Version:
6.x
Located at core/event.php
Methods summary
public static
|
#
attach( string $eventName, string $function, mixed $options = NULL )
Attach observer
Parameters
- $eventName
- event name
- $function
- function name
- $options
additional options, default NULL
function my_function($object, $args)
{
}
$function = 'my_function';
Core_Event::attach('Class.onBeforeDelete', $function);
|
public static
|
#
attachFirst( string $eventName, string $function, mixed $options = NULL )
Attach observer to the beginning of the queue
Attach observer to the beginning of the queue
Parameters
- $eventName
- event name
- $function
- function name
- $options
additional options, default NULL
class my_class
{
static public function my_function($object, $args)
{
}
}
Core_Event::attach('Class.onBeforeDelete', array('my_class', 'my_function'));
|
public static
|
#
detach( string $eventName, string $function )
Detach observer
Parameters
- $eventName
- event name
- $function
function name
$function = 'my_function';
Core_Event::detach('Class.onBeforeDelete', $function);
|
public static
mixed
|
#
getLastReturn( )
Get the last returned value
Get the last returned value
$value = Core_Event::getLastReturn();
Returns
mixed
|
public static
|
#
notify( $eventName, $object = NULL, $args = array() )
Notify all observers. If observer return FALSE, the cycle will stop.
Notify all observers. If observer return FALSE, the cycle will stop.
Core_Event::notify('Class.onBeforeDelete', $this, array($primaryKey));
Parameters
- $eventName
- of event
- $object
- $args
|
public static
|
#
getCount( string $eventName )
Get count of observers
Parameters
- $eventName
event name
echo Core_Event::getCount('Class.onBeforeDelete');
|
Properties summary
protected static
array
|
$_attached
List of attached observers
List of attached observers
|
|
protected static
misex
|
$_lastReturn
|
|