Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Notify Widget

Security covered Under active development 96 sites

Part of the Notify ecosystem · 5 projects

This module adds a notification widget to your site, displaying an icon with a count of unread messages. Notifications link directly to their content and are automatically marked as read upon clicking. It also provides a service to send notifications to single or multiple users programmatically.

Provides a notifications widget that adds a notifications icon to the page for the user to access their notifications. The icons displays an iOS style red badge containing the number of unread notifications, and each notification has a click-thru link that automatically sets the notification status to read when clicked.

The module also provides a service (notify_widget.api) that has a send() method and it is this method that should be used to set up notification for users, eg.

Sending to a single user

\Drupal::service('notify_widget.api')->send(
  '<module_name>',
  'warning',
  'Password Expiry!',
  'Your password is about to expire in 5 days.',
  1,
  '/user/pasword'
);

Sending to multiple users

\Drupal::service('notify_widget.api')->send(
  '<module_name>',
  'warning',
  'Password Expiry!',
  'Your password is about to expire in 5 days.',
  [1, 2, 3],
  '/user/pasword'
);

The first example will set a notification for user 1 (top admin), notifying them of the fact that their password will soon expire, and the notification will link to the user password page. The first argument is the "source" argument, and can take any value, but it is suggested to use the name of the module that sets the notification. As yet, the value is unused, but may be used in the future to filter notifications.

The second example above will send the same notification, but it will go to users 1, 2, and 3.

To display the notifications on the site, go to the block layout page and add the "Notify Widget" block to a region on your site. Set the block so that it only displays for authenticated users.

The notify widget settings can be reached under Configuration > System > Notify Widget Settings, and settings include the maximum number of notifications and whether to use the CSS included with the module or not. If you choose not to use the CSS provided, you must style the notifications in your own theme.

Drupal 10–11

Ask your assistant about Notify Widget

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
15
Tracked since
Oct 2023
Latest release
9 months ago
Releases (12 mo)
2 ▲ from 1
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
1.0.x-dev Dev 10–11 Nov 24, 2023
1.0.3 Stable 10 Nov 16, 2023
1.0.2 Stable 10 Oct 25, 2023
1.0.1 Stable 10 Oct 24, 2023
1.0.0 Stable 10 Oct 14, 2023