From f4b10b56b611f06f346393e4fb7724c6c4ab1049 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Mon, 22 Jul 2013 12:46:58 +0400 Subject: [PATCH] fixes #651 --- apps/advanced/frontend/widgets/Alert.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/advanced/frontend/widgets/Alert.php b/apps/advanced/frontend/widgets/Alert.php index f3a31cb..7442b3a 100644 --- a/apps/advanced/frontend/widgets/Alert.php +++ b/apps/advanced/frontend/widgets/Alert.php @@ -20,6 +20,7 @@ use yii\helpers\Html; */ class Alert extends \yii\bootstrap\Alert { + private $doNotRender = false; public function init() { if ($this->body = \Yii::$app->getSession()->getFlash('error')) { @@ -31,10 +32,17 @@ class Alert extends \yii\bootstrap\Alert } elseif ($this->body = \Yii::$app->getSession()->getFlash('warning')) { } else { - // no message passed, no need to render widget + $this->doNotRender = true; return; } parent::init(); } -} \ No newline at end of file + + public function run() + { + if (!$this->doNotRender) { + parent::run(); + } + } +}