Document toolboxDocument toolbox

(2024.2) Triggering Events

attachDb / attach

Attaches all Event Listeners for the specified event name. attachDb is used when adding events to the database. attach is used when triggering events immediately.

PCR_Event::attachDb(string $event, array $listeners) PCR_Event::attach(string $event, array $listeners)

Parameters

$event: The event identifier. A unique identifier for this event trigger

$listeners: An array for key-value pairs. Listener Class as the Key and Listener Function as the value.

trigger

PCR_Event::trigger(string $event, array $listeners)

Parameters

$event: The event identifier. A unique identifier for this event trigger

$listeners: An array of key-value pairs. Listener Class as the Key and Listener Function as the value.

detachDb / detach

Detaches all Event Listeners for the specified event name. detachDb is used when adding events to the database. detach is used when triggering events immediately.

PCR_Event::detachDb(string $event, array $listeners) PCR_Event::detach(string $event, array $listeners)

Parameters

$event: The event identifier. A unique identifier for this event trigger

$listeners: An array of key-value pairs. Listener Class as the key and Listener Function as value. Removes the Event Listener from the Event system. Only needed if the process is going to continue to trigger other events.

Example: Triggering a GLA Relace

In this example the GLA Replace Event is triggered with specific parameters. For detailed information on which Events can be triggered, and how to trigger those Events, please navigate to the Triggerable Events List page.