Commit c5506285 by Kartik Visweswaran

CSS Class assignment correction # 2.

Ensure previous CSS classes are not appended and reinitialized in the foreach loop.
parent affa9589
......@@ -41,10 +41,11 @@ class Alert extends Widget
$this->_doNotRender = true;
$session = \Yii::$app->getSession();
$flashes = $session->getAllFlashes();
$baseCssClass = isset($this->options['class']) ? $this->options['class'] : '';
foreach ($flashes as $type => $message) {
if (in_array($type, $this->allowedTypes)) {
$class = ($type === 'error') ? 'alert-danger' : 'alert-' . $type;
Html::addCssClass($this->options, $class);
$this->options['class'] = (($type === 'error') ? "alert-danger" : "alert-{$type}") . ' ' . $baseCssClass;
echo BsAlert::widget([
'body' => $message,
'closeButton' => $this->closeButton,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment