Skip to content

Special Variables

The following variables will be automatically available within your message template.

Event Variables

eventThe underlying triggered Event.
objectThe element or object which triggered the notification. (aka $event->sender)

People Variables

currentUserThe logged-in User who triggered the notification.

One recipient per outgoing message

Each message will be parsed separately for each individual recipient.

recipientIndividual recipient of each message.
recipient.userUser model of recipient.
recipient.nameName of recipient.
recipient.emailAddressEmail address of recipient.
recipient.phoneNumberPhone number of recipient.
recipient.emailFieldField from which the email address was retrieved.
recipient.smsFieldField from which the phone number was retrieved.

Element Variables

entry (or another type)Alias of element. (see below)
elementElement which triggered the event.
originalThe original version of a changed Element. (see below)

Alias of element

The element variable will be automatically aliased based on its element type:

VariableElement Type
matrixBlockMatrix Block

Supports plugins and modules!

This pattern also works for third-party Elements introduced by plugins or modules.

Fetching the original element

If the notification was triggered by an "on save" event, the original element will also be fetched prior to saving.

This can be very useful when comparing the original (pre-save) values to the element (post-save) values.

Optionally Skip Messages

One major reason to compare original with element is to optionally skip messages based on your own custom Twig logic.