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
Project information
- Module categories: Content Editing Experience, Developer Tools
- 17 sites report using this module
- Created by kevinquillen on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.