Class dmstr\widgets\Alert

Inheritancedmstr\widgets\Alert » yii\bootstrap\Widget

Alert widget renders a message from session flash for AdminLTE alerts. All flash messages are displayed in the sequence they were assigned using setFlash. You can set message as following:

\Yii::$app->getSession()->setFlash('error''<b>Alert!</b> Danger alert preview. This alert is dismissable.');

Multiple messages could be set as follows:

\Yii::$app->getSession()->setFlash('error', ['Error 1''Error 2']);

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$alertTypes array The alert types configuration for the flash messages. dmstr\widgets\Alert
$closeButton array The options for rendering the close button tag. dmstr\widgets\Alert

Public Methods

Hide inherited methods

MethodDescriptionDefined By
init() Initializes the widget. dmstr\widgets\Alert

Property Details

$alertTypes public property

The alert types configuration for the flash messages. This array is setup as $key => $value, where:

  • $key is the name of the session flash variable
  • $value is the array:
    - class of alert type (i.e. danger, success, info, warning)
    - icon for alert AdminLTE
    
public array $alertTypes = ['error' => ['class' => 'alert-danger''icon' => '<i class="icon fa fa-ban"></i>'], 'danger' => ['class' => 'alert-danger''icon' => '<i class="icon fa fa-ban"></i>'], 'success' => ['class' => 'alert-success''icon' => '<i class="icon fa fa-check"></i>'], 'info' => ['class' => 'alert-info''icon' => '<i class="icon fa fa-info"></i>'], 'warning' => ['class' => 'alert-warning''icon' => '<i class="icon fa fa-warning"></i>']]
$closeButton public property

The options for rendering the close button tag.

public array $closeButton = []

Method Details

init() public method

Initializes the widget.

This method will register the bootstrap asset bundle. If you override this method, make sure you call the parent implementation first.

public void init ( )