protected function launch() { $tags = Post::find()->category($this->categoryId)->published()->innerJoinWith('tags', false)->select(['id' => '{{%grom_tag}}.id', 'title' => '{{%grom_tag}}.title', 'alias' => '{{%grom_tag}}.alias', 'weight' => 'count({{%grom_tag}}.id)'])->groupBy('{{%grom_tag}}.id')->asArray()->all(); $maxWeight = 0; array_walk($tags, function ($v) use(&$maxWeight) { $maxWeight = max($v['weight'], $maxWeight); }); echo $this->render('tag/tagPostCloud', ['tags' => $tags, 'fontBase' => $this->fontBase, 'fontSpace' => $this->fontSpace, 'maxWeight' => $maxWeight, 'categoryId' => $this->categoryId]); $this->getView()->registerAssetBundle(TagAsset::className()); }
protected function launch() { if (!$this->tag instanceof Tag) { $this->tag = Tag::findOne(intval($this->tag)); } if (empty($this->tag)) { throw new InvalidConfigException(Yii::t('gromver.platform', 'Tag not found.')); } echo $this->render($this->layout, ['dataProvider' => new ActiveDataProvider(['query' => $this->tag->getTagToItems(), 'pagination' => ['pageSize' => $this->pageSize]]), 'itemLayout' => $this->itemLayout, 'model' => $this->tag]); $this->getView()->registerAssetBundle(TagAsset::className()); }
protected function launch() { echo $this->render('tag/tagCloud', ['tags' => $this->_tags]); $this->getView()->registerAssetBundle(TagAsset::className()); }