The Notification Message module for Drupal 8 lets content editors quickly and easily publish configurable notifications. It can create site-wide notifications, conditional alerts, or other site messages — all using a consolidated UI that doesn’t require editors to stitch together functionality with complex combinations of core and contributed modules.
Have your organization’s hours of operation changed for the holiday? Is a specific product on backorder? Has a service area been affected by a storm system? No matter who needs to read it, what it needs to say, or when it needs to be automatically published and unpublished, Notification Message makes crafting messages to users simple.
I built the Notification Message module to help Nashville Public Library broadcast site-wide or contextual messages to their customers via time-boxed notification banners. Their previous system, built on Drupal 7, used separate content types for each variety of notification, and relied on configurations completed elsewhere in the site (blocks, contexts, scheduled or manual publishing) to function properly. Notification Message provides a clean, natural editorial experience and bakes in a lot of configuration options.
Notification Message un-clutters the content management experience and provides simple but powerful tools for editors. Notifications are:
- Published and unpublished automatically within a specified date and time range
- Built using custom entities to maintain separation from the standard content publishing experience
- Linked in the Content Menu right out of the box to slide naturally into the content admin UI
- Highly configurable via conditions to show up when, how and to who you want
- Extensible far beyond basic site-wide banner messages using custom fields, custom templates and custom conditions
- Complete with granular permissions for both administering custom notification message types and managing notification content
Setting up Notification Message — and your first notification — is simple. First download the Notification Message module using the composer workflow:
composer require drupal/notification_message
If you need help with composer, check out using composer to download contributed modules on Drupal.org. Once the Notification Message module is available in your project, you’re ready to get started.
- Enable Notification Message via
drush en notification_messageor directly from the Extend page at
- Navigate to the Content page at
/admin/content, then to the new navigation item Notification message
- Click Add notification message, choose the Global type (for now) and complete the entity edit form, making sure to select the appropriate theme under Notification Conditions / Current Theme, and a date & time range that includes right now under Notification Options / Message Publish
- After saving your notification, head to the Block layout page at
/admin/structure/blockand place the Notification messages block (via the Place block button) in the appropriate region
Mission accomplished! Now you’ll see your global notification in the region you assigned as long as the current date & time are within the date range you indicated in the Message Publish section of the entity edit form. You can create new notification message types from the Notification Message types page at
/admin/structure/notification-message-types that can respond to diverse conditions such as Page URL, node attributes and user attributes — or any other conditions defined by your site — and can include custom fields and custom display configurations.
Custom templates for your custom notification types can override or extend the included
notification-messages.html.twig templates for a variety of presentations — from the standard site-wide notification banner to whatever you can imagine.