marqu3s/yii2-sweet-alert

Alert widget based on SweetAlert extension {@link http://tristanedwards.me/sweetalert)

Installs: 315

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 3

Forks: 18

Type:yii2-extension

v1.0.0 2017-09-18 17:26 UTC

This package is auto-updated.

Last update: 2024-12-24 20:50:07 UTC


README

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:

  1. Default usage, render all flash messages stored in session flash via Yii::$app->session->setFlash().
echo Alert::widget(); 
  1. 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