PHP Class Elgg\EventsService

Since: 1.9.0
Inheritance: extends HooksRegistrationService, use trait Profilable
ファイルを表示 Open project: elgg/elgg Class Usage Examples

Public Methods

Method Description
__construct ( Inspector $inspector = null ) Constructor
registerHandler ( $name, $type, $callback, $priority = 500 )
trigger ( $event, $type, $object = null, array $options = [] ) Triggers an Elgg event.
triggerAfter ( string $event, string $object_type, string $object = null ) : true Trigger an "After event" indicating a process has finished.
triggerBefore ( string $event, string $object_type, string $object = null ) : boolean Trigger a "Before event" indicating a process is about to begin.
triggerDeprecated ( string $event, string $object_type, string $object = null, string $message, string $version ) : boolean Trigger an event normally, but send a notice about deprecated use if any handlers are registered.

Method Details

__construct() public method

Constructor
public __construct ( Inspector $inspector = null )
$inspector Elgg\Debug\Inspector Inspector

registerHandler() public method

public registerHandler ( $name, $type, $callback, $priority = 500 )

trigger() public method

Triggers an Elgg event.
See also: elgg_trigger_event
See also: elgg_trigger_after_event
public trigger ( $event, $type, $object = null, array $options = [] )
$options array

triggerAfter() public method

Unlike regular events, all the handlers will be called, their return values ignored. To register for an after event, append ":after" to the event name when registering.
See also: triggerBefore
Since: 2.0.0
public triggerAfter ( string $event, string $object_type, string $object = null ) : true
$event string The event type. The fired event type will be appended with ":after".
$object_type string The object type
$object string The object involved in the event
return true

triggerBefore() public method

Like regular events, a handler returning false will cancel the process and false will be returned. To register for a before event, append ":before" to the event name when registering.
See also: trigger
See also: triggerAfter
Since: 2.0.0
public triggerBefore ( string $event, string $object_type, string $object = null ) : boolean
$event string The event type. The fired event type will be appended with ":before".
$object_type string The object type
$object string The object involved in the event
return boolean False if any handler returned false, otherwise true

triggerDeprecated() public method

Trigger an event normally, but send a notice about deprecated use if any handlers are registered.
See also: trigger
public triggerDeprecated ( string $event, string $object_type, string $object = null, string $message, string $version ) : boolean
$event string The event type
$object_type string The object type
$object string The object involved in the event
$message string The deprecation message
$version string Human-readable *release* version: 1.9, 1.10, ...
return boolean