Skip to content

DaveFerger/yii2-sweet-alert

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alert Widget for Yii 2

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yii2mod/yii2-sweet-alert "*"

or add

"yii2mod/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 \yii2mod\alert\Alert::widget([
        'type' => \yii2mod\alert\Alert::TYPE_WARNING,
        'options' => [
            'title' => 'Success message',
            '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

About

Alert Widget for Yii 2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%