drexlerux/yii2-bootstrap-sweetalert

Alert widget based on bootstrap-sweetalert extension {@link http://lipis.github.io/bootstrap-sweetalert/)

v1.0.1 2017-09-10 20:11 UTC

This package is not auto-updated.

Last update: 2024-09-15 03:13:51 UTC


README

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist drexlerux/yii2-bootstrap-sweetalert "*"

or add

"drexlerux/yii2-bootstrap-sweetalert": "*"

to the require section of your composer.json.

Usage

Once the extension is installed, simply add widget to your page as follows:

echo \drexlerux\sweetalert\SweetAlert::widget([
        'type' => \drexlerux\sweetalert\SweetAlert::TYPE_WARNING,
        'options' => [
            'title' => 'Warning message',
            'text' => "Do you want to delete it?",
            'confirmButtonText'  => "Yes, delete it!",
            'cancelButtonText' =>  "No, cancel plx!"
        ]
]);

Overrid Confirm

SweetAlertAsset overrides javascript confirm dialog by default. If you want to keep default edit your config.php

'assetManager' => [
    'bundles' => [
        'drexlerux\sweetalert\SweetAlertAsset' => [
            'overrideConfirm' => false
        ]
    ]
]

Alert Options

You can find them on the options page