Commit f4b10b56 by Alexander Makarov

fixes #651

parent aa3e8160
...@@ -20,6 +20,7 @@ use yii\helpers\Html; ...@@ -20,6 +20,7 @@ use yii\helpers\Html;
*/ */
class Alert extends \yii\bootstrap\Alert class Alert extends \yii\bootstrap\Alert
{ {
private $doNotRender = false;
public function init() public function init()
{ {
if ($this->body = \Yii::$app->getSession()->getFlash('error')) { if ($this->body = \Yii::$app->getSession()->getFlash('error')) {
...@@ -31,10 +32,17 @@ class Alert extends \yii\bootstrap\Alert ...@@ -31,10 +32,17 @@ class Alert extends \yii\bootstrap\Alert
} elseif ($this->body = \Yii::$app->getSession()->getFlash('warning')) { } elseif ($this->body = \Yii::$app->getSession()->getFlash('warning')) {
} else { } else {
// no message passed, no need to render widget $this->doNotRender = true;
return; return;
} }
parent::init(); parent::init();
} }
}
\ No newline at end of file public function run()
{
if (!$this->doNotRender) {
parent::run();
}
}
}
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