Example #1
0
 public function init()
 {
     parent::init();
     $this->language or $this->language = Yii::$app->language;
     $this->_tags = (new Query())->select('t.id, t.title, t.alias, t.language, count(t2m.item_id) AS weight')->from(Tag::tableName() . ' t')->innerJoin(Tag::pivotTableName() . ' t2m', 't.id=t2m.tag_id')->where(['t.language' => $this->language])->groupBy('t.id')->all();
     shuffle($this->_tags);
 }
 public function init()
 {
     parent::init();
     if (!isset($this->model)) {
         try {
             $attributes = \Yii::$app->user->getParamsArray();
         } catch (InvalidParamException $e) {
             $attributes = [];
         }
         $this->model = self::model();
         $this->model->setAttributes($attributes);
     }
     $visibleParams = $this->getVisibleParams();
     foreach ($this->model->attributes() as $attribute) {
         if (!in_array($attribute, $visibleParams)) {
             $this->model->undefineAttribute($attribute);
         }
     }
 }
 public function init()
 {
     parent::init();
 }