Skip to content
This repository was archived by the owner on Jan 9, 2022. It is now read-only.

Commit a818379

Browse files
committed
Bug Fixed
Fixed a problem when you set 'enableSessionFlash' to false.
1 parent bea1505 commit a818379

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

NotyWidget.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ public function run()
9191

9292
if ($this->enableSessionFlash) {
9393
$flashes = Yii::$app->session->getAllFlashes();
94+
95+
if (empty($flashes)) {
96+
return;
97+
}
98+
9499
$view = $this->getView();
95100
$script = "";
96101

@@ -106,9 +111,9 @@ public function run()
106111
$script .= "$.noty.setText({$type}.options.id, '{$text}');\r\n";
107112
$script .= "$.noty.setType({$type}.options.id, '{$type}');\r\n";
108113
}
114+
115+
$view->registerJs($script);
109116
}
110-
111-
$view->registerJs($script);
112117
}
113118

114119
/**
@@ -177,4 +182,4 @@ protected function getIcon($type) {
177182
return Html::tag('i', '', ['class' => $class]) . ' ';
178183
}
179184

180-
}
185+
}

0 commit comments

Comments
 (0)