Skip to content

Notification Elements

Notifications are third-party elements within the Craft ecosystem.

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

Meta

Simple "Title" and "Description" fields.

Event

Notifications are each tied to a specific event within the Craft system. When that particular event is triggered, the Notification will be sent out.

Message

Notifications will send a specific message, written in Twig or plain text. See more about templating and special variables.

Recipients

Notifications get sent to a specific set of recipients. Some message types can only reach a limited audience, while other types can be sent to a wide variety of recipients.

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);