Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Sweet Alert

Security covered Under active development 60 sites

This module replaces default JavaScript alerts with a modern, interactive dialog box. It supports simple alerts, confirmation messages, and toast notifications.

Integrates the SweetAlert plugin to act as a modern replacement for JavaScript's alert. It is capable of not only a simple alert box, but confirmation dialogs and UI toast messages too.

Version 2.x

The 2.0.0 release uses the updated SweetAlert2.

Installation

This module requires the SweetAlert2 library. It can be downloaded at https://github.com/sweetalert2/sweetalert2/releases.

Download sweetalert2.all.min.js to (webroot)/libraries/sweetalert2.

Currently supported plugin version: 11.x.

Usage

The admin area for SweetAlert now has a simple demo area to try different configuration options and see what the alert will look like.

You can fire SweetAlert with an AjaxResponse in Drupal 9+ by returning a response like so:

    $response = new AjaxResponse();
    $response->addCommand(new SweetAlertCommand(
        [
          'title' => $title,
          'text' => $message,
        ]
      )
    );
    return $response;

Upgrade path

Many of the options may have changed from version 1 to 2 of the JS plugin. Please refer to the plugins update path docs to understand what code you have implemented, if any, that needs to be changed. https://sweetalert2.github.io/#download

Drupal 9–10 · not 11

Ask your assistant about Sweet Alert

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
6
Tracked since
Feb 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core PHP Release date
2.0.1 Stable 9–10 Feb 27, 2023
2.0.0 Stable 9–10 Feb 27, 2023
2.0.0-alpha3 Pre-release 9–10 Feb 27, 2023
2.0.0-alpha2 Pre-release 9–10 Feb 27, 2023
2.0.0-alpha1 Pre-release 9–10 Feb 26, 2023
2.0.x-dev Dev 9–10 Feb 24, 2023