Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core\event\manager Class Reference

Class used for event dispatching. More...

Static Public Member Functions

static database_transaction_commited ()
 Notification from DML layer.
 
static database_transaction_rolledback ()
 Notification from DML layer.
 
static dispatch (\core\event\base $event)
 Trigger new event.
 
static get_all_observers ()
 Returns all observers in the system.
 
static phpunit_replace_observers (array $observers)
 Replace all standard observers.
 
static phpunit_reset ()
 Reset everything if necessary.
 

Static Protected Member Functions

static add_observers (array $observers, $file, $plugintype=null, $plugin=null)
 Add observers.
 
static get_observing_classes (\core\event\base $event)
 Returns list of classes related to this event.
 
static init_all_observers ()
 Initialise the list of observers.
 
static order_all_observers ()
 Reorder observers to allow quick lookup of observer for each event.
 
static process_buffers ()
 

Static Protected Attributes

static array $allobservers = null
 cache of all observers
 
static array $buffer = array()
 buffer of event for dispatching
 
static bool $dispatching = false
 evert dispatching already in progress - prevents nesting
 
static array $extbuffer = array()
 buffer for events that were not sent to external observers when DB transaction in progress
 
static bool $reloadaftertest = false
 should we reload observers after the test?
 

Detailed Description

Class used for event dispatching.

Note: Do NOT use directly in your code, it is intended to be used from base event class only.

Member Function Documentation

◆ add_observers()

static core\event\manager::add_observers ( array $observers,
$file,
$plugintype = null,
$plugin = null )
staticprotected

Add observers.

Parameters
array$observers
string$file
string$plugintypePlugin type of the observer.
string$pluginPlugin of the observer.

◆ get_all_observers()

static core\event\manager::get_all_observers ( )
static

Returns all observers in the system.

This is only for use for reporting on the list of observers in the system.

Return values
arrayAn array of stdClass with all core observer details.

◆ get_observing_classes()

static core\event\manager::get_observing_classes ( \core\event\base $event)
staticprotected

Returns list of classes related to this event.

Parameters
core\event\base$event
Return values
array

◆ phpunit_replace_observers()

static core\event\manager::phpunit_replace_observers ( array $observers)
static

Replace all standard observers.

Parameters
array$observers
Return values
array
Exceptions
coding_Exceptionif used outside of unit tests.

◆ phpunit_reset()

static core\event\manager::phpunit_reset ( )
static

Reset everything if necessary.

Exceptions
coding_Exceptionif used outside of unit tests.

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