<?php use yii\helpers\Html; use yii\grid\GridView; use yii\helpers\ArrayHelper; use yii\widgets\Pjax; use core\entities\Settings; use backend\components\ToggleColumn; /** * @var yii\web\View $this * @var \backend\forms\SettingsSearch $searchModel * @var yii\data\ActiveDataProvider $dataProvider */ $this->title = Yii::t('main', 'Settings'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="setting-index"> <p> <?= Html::a( Yii::t('buttons','Create Setting'), ['create'], ['class' => 'btn btn-success'] ) ?> </p> <div class="box"> <div class="box-body"> <?php Pjax::begin(); ?> <?= GridView::widget( [ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ //'id', //'type', [ 'attribute' => 'section', 'filter' => ArrayHelper::map( Settings::find()->select('section')->distinct()->where(['<>', 'section', ''])->all(), 'section', 'section' ), ], 'key', 'value:ntext', [ 'class' => ToggleColumn::class, 'attribute' => 'active', 'filter' => [1 => Yii::t('yii', 'Yes'), 0 => Yii::t('yii', 'No')], 'options' => ['style' => 'width: 100px;'], 'contentOptions' => ['class' => 'text-center'], ], [ 'class' => 'yii\grid\ActionColumn', 'options' => ['style' => 'width: 100px;'], 'contentOptions' => ['class' => 'text-center'], ], ], ] ); ?> <?php Pjax::end(); ?> </div> </div> </div>