コード例 #1
0
 /**
  * Generate flashes message
  *
  * @param \yii\web\Session $session
  */
 protected function showFlashes($session)
 {
     $flashes = $session->getAllFlashes();
     foreach ($flashes as $type => $data) {
         $option = $this->getOption($type);
         if ($option) {
             $data = (array) $data;
             foreach ($data as $i => $message) {
                 $title = $option['title'];
                 $class = $option['class'];
                 if ($this->enableIcon) {
                     $title = Html::tag('i', '', ['class' => $option['icon']]) . $title;
                     $class .= ' gritter-icon';
                 }
                 $this->registerJS($title, $message, $class, '', $this->gritterOptions);
             }
             $session->removeFlash($type);
         }
     }
 }