Special Variables
The following variables will be automatically available within your message template.
Event Variables
Variable | Description |
---|---|
event | The underlying triggered Event. |
object | The element or object which triggered the notification. (aka $event->sender ) |
People Variables
Variable | Description |
---|---|
currentUser | The logged-in User who triggered the notification. |
One recipient per outgoing message
Each message will be parsed separately for each individual recipient.
Variable | Description |
---|---|
recipient | Individual recipient of each message. |
recipient.user | User model of recipient. |
recipient.name | Name of recipient. |
recipient.emailAddress | Email address of recipient. |
recipient.phoneNumber | Phone number of recipient. |
recipient.emailField | Field from which the email address was retrieved. |
recipient.smsField | Field from which the phone number was retrieved. |
Element Variables
Variable | Description |
---|---|
entry (or another type) | Alias of element . (see below) |
element | Element which triggered the event. |
original | The original version of a changed Element. (see below) |
Alias of element
The element
variable will be automatically aliased based on its element type:
Variable | Element Type |
---|---|
user | User |
entry | Entry |
asset | Asset |
matrixBlock | Matrix Block |
etc | etc |
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.