CSS Class assignment corrected.

Used ```Html::addCssClass``` and ```Html::removeCssClass``` more effectively.
This commit is contained in:
Kartik Visweswaran
2013-11-20 19:58:25 +05:30
parent 70f41387b6
commit affa9589dc

View File

@ -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;
} }