marqu3s / yii2-sweet-alert
Alert widget based on SweetAlert extension {@link http://tristanedwards.me/sweetalert)
Installs: 311
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 18
Type:yii2-extension
Requires
- bower-asset/sweetalert: *
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-10-24 20:29:43 UTC
README
- Alert widget based on SweetAlert extension http://tristanedwards.me/sweetalert
- Forked from yii2mod/yii2-sweet-alert and adapted to suit my needs.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist marqu3s/yii2-sweet-alert "*"
or add
"marqu3s/yii2-sweet-alert": "*"
to the require section of your composer.json.
Usage
Once the extension is installed, simply add widget to your page as follows:
- Default usage, render all flash messages stored in session flash via Yii::$app->session->setFlash().
echo Alert::widget();
- Custom usage example:
echo Alert::widget([ 'useSessionFlash' => false, 'options' => [ 'title' => 'Success message', 'type' => 'Success', 'text' => "You will not be able to recover this imaginary file!", 'confirmButtonText' => "Yes, delete it!", 'cancelButtonText' => "No, cancel plx!" ] ]);
Alert Options
You can find them on the options page