Skip to content

Notification Elements

Notifications are third-party elements within the Craft ecosystem.

Tabs

Each individual Notification consists of four parts, separated into tabs...

Meta

Contains the native Title field, plus any custom fields you've attached.

Event

Each Notification is tied to a specific event within the Craft system. When that particular event is triggered, the corresponding message will be sent out.

Message

Write a custom message for each Notification. Within the message's Twig template you can use a series of special variables about the event which triggered it.

Recipients

Select which recipients will receive each Notification. The available options for recipients depends primarily on which message type was selected.

Fetching Notification Elements

Whether working in Twig or PHP, you can use the following helper functions to fetch Notifications...

Twig

twig
{# Use an element query for Notifications #}
{% set notifications = notifier.notifications.all() %}

{# Get a specific Notification by its ID #}
{% set notification = notifier.getNotification(id) %}

PHP

php
use doublesecretagency\notifier\helpers\Notifier;

// Use an element query for Notifications
$notifications = Notifier::notifications()->all();

// Get a specific Notification by its ID
$notification = Notifier::getNotification($id);