Elgg  Version 2.3
Public Member Functions | Public Attributes | List of all members
Elgg\EventsService Class Reference
Inheritance diagram for Elgg\EventsService:
Elgg\HooksRegistrationService

Public Member Functions

 __construct (Inspector $inspector=null)
 Constructor. More...
 
 registerHandler ($name, $type, $callback, $priority=500)
 {} More...
 
 trigger ($event, $type, $object=null, array $options=array())
 Triggers an Elgg event. More...
 
 triggerBefore ($event, $object_type, $object=null)
 Trigger a "Before event" indicating a process is about to begin. More...
 
 triggerAfter ($event, $object_type, $object=null)
 Trigger an "After event" indicating a process has finished. More...
 
 triggerDeprecated ($event, $object_type, $object=null, $message, $version)
 Trigger an event normally, but send a notice about deprecated use if any handlers are registered. More...
 
- Public Member Functions inherited from Elgg\HooksRegistrationService
 setLogger (\Elgg\Logger $logger=null)
 Set a logger instance, e.g. More...
 
 registerHandler ($name, $type, $callback, $priority=500)
 Registers a handler. More...
 
 unregisterHandler ($name, $type, $callback)
 Unregister a handler. More...
 
 clearHandlers ($name, $type)
 Clears all handlers for a specific hook. More...
 
 getAllHandlers ()
 Returns all registered handlers as array( $name => array( $type => array( $priority => array( callback, callback, ) ) ) More...
 
 hasHandler ($name, $type)
 Is a handler registered for this specific name and type? "all" handlers are not considered. More...
 
 getOrderedHandlers ($name, $type)
 Returns an ordered array of handlers registered for $name and $type. More...
 
 backup ()
 Temporarily remove all event/hook registrations (before tests) More...
 
 restore ()
 Restore backed up event/hook registrations (after tests) More...
 

Public Attributes

const OPTION_STOPPABLE = 'stoppable'
 
const OPTION_DEPRECATION_MESSAGE = 'deprecation_message'
 
const OPTION_DEPRECATION_VERSION = 'deprecation_version'
 
- Public Attributes inherited from Elgg\HooksRegistrationService
const REG_KEY_PRIORITY = 0
 
const REG_KEY_INDEX = 1
 
const REG_KEY_HANDLER = 2
 

Additional Inherited Members

- Protected Member Functions inherited from Elgg\HooksRegistrationService
 getMatcher ($spec)
 Create a matcher for the given callable (if it's for a static or dynamic method) More...
 
- Protected Attributes inherited from Elgg\HooksRegistrationService
 $logger
 

Detailed Description

Examples:
/root/Elgg/engine/lib/output.php, and /root/Elgg/engine/lib/views.php.

Definition at line 14 of file EventsService.php.

Constructor & Destructor Documentation

Elgg\EventsService::__construct ( Inspector  $inspector = null)

Constructor.

Parameters
Inspector$inspectorInspector

Definition at line 31 of file EventsService.php.

Member Function Documentation

Elgg\EventsService::registerHandler (   $name,
  $type,
  $callback,
  $priority = 500 
)

{}

Definition at line 41 of file EventsService.php.

Elgg\EventsService::trigger (   $event,
  $type,
  $object = null,
array  $options = array() 
)

Triggers an Elgg event.

See also
elgg_trigger_event
elgg_trigger_after_event private

Definition at line 78 of file EventsService.php.

Elgg\EventsService::triggerAfter (   $event,
  $object_type,
  $object = null 
)

Trigger an "After event" indicating a process has finished.

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.

Parameters
string$eventThe event type. The fired event type will be appended with ":after".
string$object_typeThe object type
string$objectThe object involved in the event
Returns
true
See also
triggerBefore
Since
2.0.0

Definition at line 162 of file EventsService.php.

Elgg\EventsService::triggerBefore (   $event,
  $object_type,
  $object = null 
)

Trigger a "Before event" indicating a process is about to begin.

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.

Parameters
string$eventThe event type. The fired event type will be appended with ":before".
string$object_typeThe object type
string$objectThe object involved in the event
Returns
bool False if any handler returned false, otherwise true
See also
trigger
triggerAfter
Since
2.0.0

Definition at line 142 of file EventsService.php.

Elgg\EventsService::triggerDeprecated (   $event,
  $object_type,
  $object = null,
  $message,
  $version 
)

Trigger an event normally, but send a notice about deprecated use if any handlers are registered.

Parameters
string$eventThe event type
string$object_typeThe object type
string$objectThe object involved in the event
string$messageThe deprecation message
string$versionHuman-readable release version: 1.9, 1.10, ...
Returns
bool
See also
trigger

Definition at line 182 of file EventsService.php.

Member Data Documentation

const Elgg\EventsService::OPTION_DEPRECATION_MESSAGE = 'deprecation_message'

Definition at line 18 of file EventsService.php.

const Elgg\EventsService::OPTION_DEPRECATION_VERSION = 'deprecation_version'

Definition at line 19 of file EventsService.php.

const Elgg\EventsService::OPTION_STOPPABLE = 'stoppable'

Definition at line 17 of file EventsService.php.


The documentation for this class was generated from the following file: