|
|
@ -41,10 +41,11 @@ class Alert extends Widget |
|
|
|
$this->_doNotRender = true; |
|
|
|
$this->_doNotRender = true; |
|
|
|
$session = \Yii::$app->getSession(); |
|
|
|
$session = \Yii::$app->getSession(); |
|
|
|
$flashes = $session->getAllFlashes(); |
|
|
|
$flashes = $session->getAllFlashes(); |
|
|
|
|
|
|
|
$baseCssClass = isset($this->options['class']) ? $this->options['class'] : ''; |
|
|
|
|
|
|
|
|
|
|
|
foreach ($flashes as $type => $message) { |
|
|
|
foreach ($flashes as $type => $message) { |
|
|
|
if (in_array($type, $this->allowedTypes)) { |
|
|
|
if (in_array($type, $this->allowedTypes)) { |
|
|
|
$class = ($type === 'error') ? 'alert-danger' : 'alert-' . $type; |
|
|
|
$this->options['class'] = (($type === 'error') ? "alert-danger" : "alert-{$type}") . ' ' . $baseCssClass; |
|
|
|
Html::addCssClass($this->options, $class); |
|
|
|
|
|
|
|
echo BsAlert::widget([ |
|
|
|
echo BsAlert::widget([ |
|
|
|
'body' => $message, |
|
|
|
'body' => $message, |
|
|
|
'closeButton' => $this->closeButton, |
|
|
|
'closeButton' => $this->closeButton, |
|
|
|