Events¶
Some PSR-14 events are dispatched while consents are generated or modified. This allows to step in the consent lifecycle and perform several actions, based on the actual event.
The following events are currently dispatched:
ApproveConsentEvent¶
This event is dispatched if a consent was approved by the user. This is especially useful when running additional actions that provide a concrete response to be rendered. The response can be attached to the dispatched event and will be handled by the dispatching controller.
DismissConsentEvent¶
This event is dispatched if a consent was dismissed by the user. This is especially useful when running additional actions that provide a concrete response to be rendered. The response can be attached to the dispatched event and will be handled by the dispatching controller.
GenerateHashEvent¶
When the HashService
generates a new consent validation hash, it
dispatches this event. It can be used to either attach a ready-to-use
validation hash or modify the hash components used to internally generate
the final hash.
ModifyConsentEvent¶
This event is dispatched after a new consent was generated, which is
not yet persisted. It allows to modify the consent while having access
to the current FinisherContext
. This allows to cancel the whole
consent process by calling $event->getFinisherContext()->cancel()
.
ModifyConsentMailEvent¶
Once the consent is persisted, the consent mail is sent to the user. It
can be modified by listening to this event, which provides the mail as
an instance of FluidEmail
along with the current FormRuntime
.
See also
View the sources on GitHub: