Browse Source

Advanced application template: Delete flash message after it was displayed

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
e1061f19ac
  1. 8
      apps/advanced/frontend/widgets/Alert.php

8
apps/advanced/frontend/widgets/Alert.php

@ -23,13 +23,13 @@ class Alert extends \yii\bootstrap\Alert
private $_doNotRender = false; 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', null, true)) {
Html::addCssClass($this->options, 'alert-danger'); Html::addCssClass($this->options, 'alert-danger');
} elseif ($this->body = \Yii::$app->getSession()->getFlash('success')) { } elseif ($this->body = \Yii::$app->getSession()->getFlash('success', null, true)) {
Html::addCssClass($this->options, 'alert-success'); Html::addCssClass($this->options, 'alert-success');
} elseif ($this->body = \Yii::$app->getSession()->getFlash('info')) { } elseif ($this->body = \Yii::$app->getSession()->getFlash('info', null, true)) {
Html::addCssClass($this->options, 'alert-info'); Html::addCssClass($this->options, 'alert-info');
} elseif ($this->body = \Yii::$app->getSession()->getFlash('warning')) { } elseif ($this->body = \Yii::$app->getSession()->getFlash('warning', null, true)) {
Html::addCssClass($this->options, 'alert-warning'); Html::addCssClass($this->options, 'alert-warning');
} else { } else {
$this->_doNotRender = true; $this->_doNotRender = true;

Loading…
Cancel
Save