Yii2-notification-wrapper

Yii2-notification-wrapper module renders a message from session flash (with ajax support). All flash messages are displayed in the sequence they were assigned using setFlash.

You can set message as following:


public function actionIndex(){

    ...

     \Yii::$app->getSession()->setFlash('error',   'noty error');

     \Yii::$app->getSession()->setFlash('info',    'noty info');

     \Yii::$app->getSession()->setFlash('success', 'noty success');

     \Yii::$app->getSession()->setFlash('warning', 'noty warning');

    ...

     return $this->render('index');

 }


 // or in ajax action


 public function actionAjax(){

     ...

     \Yii::$app->getSession()->setFlash('error',   'ajax error');

     \Yii::$app->getSession()->setFlash('info',    'ajax info');

     \Yii::$app->getSession()->setFlash('success', 'ajax success');

     \Yii::$app->getSession()->setFlash('warning', 'ajax warning');

     ...

     $data = 'Some data to be returned in response to ajax request';

     Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

     return $data;

  }

more here

Added new layers

v. 2.1 - Bootstrap Alert


use lo\modules\noty\widgets\Wrapper;


echo Wrapper::widget();

v. 2.2 - Notify.js




use lo\modules\noty\widgets\Wrapper;


echo Wrapper::widget([

    'layerClass' => 'lo\modules\noty\widgets\layers\Notifyjs',

    'options' => [

           // whether to hide the notification on click

          'clickToHide' => true,


           // whether to auto-hide the notification

           'autoHide' => true,


           // if autoHide, hide after milliseconds

           'autoHideDelay' => 5000,


           // show the arrow pointing at the element

           'arrowShow' => true,


           // arrow size in pixels

           'arrowSize' => 5,


           // position defines the notification position though uses the defaults below

           'position' => '...',


           // default positions

           'elementPosition' => 'bottom left',

           'globalPosition' => 'top right',


           // default style

           'style' => 'bootstrap',


          // default class (string or [string])

           'className' => 'error',


           // show animation

           'showAnimation' => 'slideDown',


           // show animation duration

           'showDuration' => 400,


           // hide animation

           'hideAnimation' => 'slideUp',


           // hide animation duration

           'hideDuration' => 200,


           // padding between element and notification

           'gap' => 2


           // and more for this library 

    ],

]);

Release 3.0 with new layers

  • Jquery Notify

  • Pnotify

  • NotifIt

and override System Confirmation

Release 4.0

* Added new layer Notie


* Custom title for Growl layer


* All layers extends from base Layer class


* 'customTitleDelimiter' and 'overrideSystemConfirm' moved to 'layerOptions'

Release 6.0

  • More new Layers

  • New options

  • showTitle

  • LayerId for display in custom div

  • and many others

EnjoY!