mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +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) {
|
foreach ($flashes as $type => $message) {
|
||||||
if (in_array($type, $this->allowedTypes)) {
|
if (in_array($type, $this->allowedTypes)) {
|
||||||
$class = ($type === 'error') ? 'alert-danger' : 'alert-' . $type;
|
$class = ($type === 'error') ? 'alert-danger' : 'alert-' . $type;
|
||||||
$this->options['class'] = $class;
|
Html::addCssClass($this->options, $class);
|
||||||
echo BsAlert::widget([
|
echo BsAlert::widget([
|
||||||
'body' => $message,
|
'body' => $message,
|
||||||
'closeButton' => $this->closeButton,
|
'closeButton' => $this->closeButton,
|
||||||
'options' => $this->options
|
'options' => $this->options
|
||||||
]);
|
]);
|
||||||
|
Html::removeCssClass($this->options, $class);
|
||||||
$session->removeFlash($type);
|
$session->removeFlash($type);
|
||||||
$this->_doNotRender = false;
|
$this->_doNotRender = false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user