Example #1
0
 public function run()
 {
     if (!$this->id) {
         throw new Exception('Slider ID is missing');
     }
     $slider = Slider::findOne($this->slider_id);
     if ($slider) {
         $slides = Slide::find()->active()->where(['slider_id' => $this->slider_id])->language()->order()->all();
         if (!empty($slides)) {
             return $this->render('Slider', ['id' => $this->id, 'sectionClass' => $this->sectionClass, 'slides' => $slides]);
         } else {
             return '';
         }
     }
     return '';
 }
Example #2
0
 /**
  * Lists all Slide models.
  * @return mixed
  */
 public function actionIndex($slider_id)
 {
     $dataProvider = new ActiveDataProvider(['query' => Slide::find()->where(['slider_id' => $slider_id])->orderBy(['position' => SORT_ASC]), 'pagination' => false]);
     return $this->render('index', ['dataProvider' => $dataProvider, 'slider_id' => $slider_id]);
 }