mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
CSS Class assignment corrected.
Used ```Html::addCssClass``` and ```Html::removeCssClass``` more effectively.
This commit is contained in:
@ -44,12 +44,13 @@ class Alert extends Widget
|
||||
foreach ($flashes as $type => $message) {
|
||||
if (in_array($type, $this->allowedTypes)) {
|
||||
$class = ($type === 'error') ? 'alert-danger' : 'alert-' . $type;
|
||||
$this->options['class'] = $class;
|
||||
Html::addCssClass($this->options, $class);
|
||||
echo BsAlert::widget([
|
||||
'body' => $message,
|
||||
'closeButton' => $this->closeButton,
|
||||
'options' => $this->options
|
||||
]);
|
||||
Html::removeCssClass($this->options, $class);
|
||||
$session->removeFlash($type);
|
||||
$this->_doNotRender = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user