/** * Renders widget content. * @return string content */ public function renderContent() { $containerTag = ArrayHelper::remove($this->containerOptions, 'tag', 'div'); $content = Html::beginTag($containerTag, $this->containerOptions); $buttonText = WidgetPageSize::t('app', 'Clear filters'); $currentValue = self::getPageSize($this->widgetId); if ($this->enableClearFilters && $currentValue !== $this->defaultValue) { $content .= Html::tag(ArrayHelper::remove($this->clearFiltersButtonOptions, 'tag', 'span'), ArrayHelper::remove($this->clearFiltersButtonOptions, 'value', WidgetPageSize::t('Clear filters')), $this->clearFiltersButtonOptions); } $content .= " {$this->text} "; $content .= Html::dropDownList('widget-page-size', $currentValue, ArrayHelper::remove($this->dropDownOptions, 'items', []), $this->dropDownOptions); $content .= Html::endTag($containerTag); return $content; }
<?php use roman444uk\yii\widgets\WidgetPageSize; use yii\helpers\ArrayHelper; use yii\helpers\Html; use yii\web\View; $tag = ArrayHelper::remove($this->context->dropDownOptions, 'tag', 'div'); ?> <?php echo Html::beginTag($tag, $this->context->containerOptions); ?> <?php if ($this->context->enableClearFilters) { ?> <?php echo Html::tag(ArrayHelper::remove($this->context->clearFiltersButtonOptions, 'tag', 'div'), WidgetPageSize::t('Clear filters'), $this->context->clearFiltersButtonOptions); ?> <?php } ?> <?php echo $this->context->text; ?> <?php echo Html::dropDownList('widget-page-size', \Yii::$app->request->cookies->getValue('_widget_page_size', $this->context->defaultValue), $this->context->dropDownOptions); echo Html::endTag($tag);
<?php use roman444uk\yii\widgets\WidgetPageSize; use yii\helpers\ArrayHelper; use yii\helpers\Html; use yii\web\View; $containerTag = ArrayHelper::remove($this->context->containerOptions, 'tag', 'div'); $clearButtonTag = ArrayHelper::remove($this->context->clearFiltersButtonOptions, 'tag', 'span'); ?> <?php echo Html::beginTag($containerTag, $this->context->containerOptions); ?> <?php if ($this->context->enableClearFilters || true) { ?> <?php echo Html::tag($clearButtonTag, WidgetPageSize::t('Clear filters'), $this->context->clearFiltersButtonOptions); ?> <?php } ?> <?php echo $this->context->text; ?> <?php echo Html::dropDownList('grid-page-size', \Yii::$app->request->cookies->getValue('_widget_page_size', $this->context->defaultValue), ArrayHelper::remove($this->context->dropDownOptions, 'items', []), $this->context->dropDownOptions); echo Html::endTag($containerTag);