bahirul/yii2-widgets-ui-flash

This package is abandoned and no longer maintained. No replacement package was suggested.

Flash Widget For Yii2

v1.4.1 2017-03-24 01:34 UTC

This package is auto-updated.

Last update: 2021-01-19 04:00:22 UTC


README

Latest Stable Version Latest Unstable Version License Total Downloads Monthly Downloads Daily Downloads

This package contain useful flash widget with flat design using Fontawesome and Animate.CSS. Flash assets depends on yii2-assets-animatecss and yii2-assets-fontawesome.

Installation

The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require bahirul/yii2-widgets-ui-flash "*"

or add

"bahirul/yii2-widgets-ui-flash": "*"

to the require section of your composer.json file.

Screenshot

Screenshot

Latest Release

NOTE: The latest version of the package is v1.4.1 released on 25, Jumadil Akhir 1438. Refer the CHANGE.md for details.

Basic Usage

in Controller


//Define your flash message 
Yii::$app->session->setFlash('error','display error'); 

in View or Layout

<?php
use bahirul\yii2\widgets\ui\FlashMessage;
?>

<!-- HTML Code -->

<?php echo FlashMessage::widget();?>

<!-- #END HTML -->

Advanced Usage

in View or Layout

<?php
use bahirul\yii2\widgets\ui\FlashMessage;
?>

<!-- HTML Code -->

<?php echo FlashMessage::widget([
    'animateCss' => 'bounce', //Animate.CSS class. Default : bounce.
    'isBold' => true, //Use bold font. Default : false.
    'closeButton' => true, //Flash close button. Default : true.
    'useIcon' => true, //Use icon in flash message. Default: true.
    'margin' => 10, //Margin between flash container. Default: 0.
    'padding' => 15, //Padding flash container. Default : 20.
    'borderRadius' => 3, //Border radius flash container. Default: 0.
    'isAjaxRemoveFlash' => true, //Show flash in ajax request. Default : false.
    'useFontawesomeAsset' => true, //Use FA asset. Default : true.
    'useAnimateCssAsset' => true, //Use AnimateCss asset. Default : true (!!! important !!! If you set this to false, you can't use close button javascript)
    'options' => [
        'class' => 'options-class', //Append Own CSS to flash container. Default: '' (null).
    ],
    'flashTypes' => [
        //Default flash types
        'error' => [
            'class' => 'flash-error',
            'icon' => '<i class="fa fa-fw fa-exclamation-circle flash-icon"></i>',
        ],
        'danger' => [
            'class' => 'flash-danger',
            'icon' => '<i class="fa fa-fw fa-ban flash-icon"></i>',
        ],
        'success' => [
            'class' => 'flash-success',
            'icon' => '<i class="fa fa-fw fa-check flash-icon"></i>',
        ],
        'info' => [
            'class' => 'flash-info',
            'icon' => '<i class="fa fa-fw fa-info flash-icon"></i>',
        ],
        'warning' => [
            'class' => 'flash-warning',
            'icon' => '<i class="fa fa-fw fa-warning flash-icon"></i>',
        ],
        'dark' => [
            'class' => 'flash-dark',
            'icon' => '<i class="fa fa-fw fa-bell flash-icon"></i>',
        ],
        'purple' => [
            'class' => 'flash-puple',
            'icon' => '<i class="fa fa-fw fa-bell flash-icon"></i>',
        ],
        //Add you own flash type here
        'own-flash' => [ //Flash name
            'class' => 'own-flash', //Flash class
            'icon' => '<i class="fa fa-fw fa-bell flash-icon"></i>', //Flash icon
        ],
    ],
]);?>

<!-- #END HTML -->

License

yii2-widgets-ui-flash is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.