Elgg  Version 6.1
Public Member Functions | List of all members
Elgg\Event Class Reference

Models an event passed to event handlers. More...

Public Member Functions

 __construct (protected PublicContainer $dic, protected string $name, protected string $type, protected $value=null, protected $params=[])
 Constructor. More...
 
 getName ()
 Get the name of the event. More...
 
 getType ()
 Get the type of the event object. More...
 
 getObject ()
 Get the object of the event. More...
 
 getValue ()
 Get the current value of the event. More...
 
 setValue ($value)
 Update the value. More...
 
 getParams ()
 Get the parameters passed to the trigger call. More...
 
 getParam (string $key, $default=null)
 Get an element of the params array. More...
 
 getEntityParam ()
 Gets the "entity" key from the params if it holds an ElggEntity. More...
 
 getUserParam ()
 Gets the "user" key from the params if it holds an ElggUser. More...
 
 elgg ()
 Get the DI container. More...
 
 getSequenceID ()
 When the event is part of a sequence a unique ID is set for each sequence. More...
 

Detailed Description

Models an event passed to event handlers.

Since
2.0.0

Definition at line 11 of file Event.php.

Constructor & Destructor Documentation

Elgg\Event::__construct ( protected PublicContainer  $dic,
protected string  $name,
protected string  $type,
protected  $value = null,
protected  $params = [] 
)

Constructor.

Parameters
PublicContainer$dicDI container
string$nameEvent name
string$typeEvent type
mixed$valueEvent value
mixed$paramsEvent params

Definition at line 22 of file Event.php.

Member Function Documentation

Elgg\Event::elgg ( )

Get the DI container.

Returns
PublicContainer

Definition at line 136 of file Event.php.

Elgg\Event::getEntityParam ( )

Gets the "entity" key from the params if it holds an ElggEntity.

Returns
|null

Definition at line 110 of file Event.php.

Elgg\Event::getName ( )

Get the name of the event.

Returns
string

Definition at line 36 of file Event.php.

Elgg\Event::getObject ( )

Get the object of the event.

Returns
mixed

Definition at line 54 of file Event.php.

Elgg\Event::getParam ( string  $key,
  $default = null 
)

Get an element of the params array.

If the params array is not an array, the default will always be returned.

Parameters
string$keyThe key of the value in the params array
mixed$defaultThe value to return if missing
Returns
mixed

Definition at line 97 of file Event.php.

Elgg\Event::getParams ( )

Get the parameters passed to the trigger call.

Returns
mixed

Definition at line 84 of file Event.php.

Elgg\Event::getSequenceID ( )

When the event is part of a sequence a unique ID is set for each sequence.

Returns
string|null

Definition at line 145 of file Event.php.

Elgg\Event::getType ( )

Get the type of the event object.

Returns
string

Definition at line 45 of file Event.php.

Elgg\Event::getUserParam ( )

Gets the "user" key from the params if it holds an ElggUser.

Returns
|null

Definition at line 123 of file Event.php.

Elgg\Event::getValue ( )

Get the current value of the event.

Returns
mixed

Definition at line 63 of file Event.php.

Elgg\Event::setValue (   $value)

Update the value.

Parameters
mixed$valueThe new value
Returns
void

Definition at line 75 of file Event.php.


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