$this->title = Module::t('page', 'Pages'); $this->params['subtitle'] = Module::t('module', 'Pages list'); $this->params['breadcrumbs'][] = $this->title; $gridId = 'pages-grid'; $gridConfig = ['id' => $gridId, 'tableOptions' => ['class' => 'table table-bordered table-hover'], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], ['attribute' => 'id', 'filter' => false], 'title', ['attribute' => 'slug', 'format' => 'html', 'value' => function ($model) { return Html::a($model['slug'], ['update', 'id' => $model['id']], ['data-pjax' => 0]); }], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) { if ($model->status === $model::STATUS_PUBLISHED) { $class = 'label-success'; } elseif ($model->status === $model::STATUS_UNPUBLISHED) { $class = 'label-warning'; } else { $class = 'label-danger'; } return '<span class="label ' . $class . '">' . $model->getStatus() . '</span>'; }, 'filter' => Html::activeDropDownList($searchModel, 'status', Page::getStatusesList(), ['class' => 'form-control', 'prompt' => Module::t('page', 'Select status')])], ['attribute' => 'created_at', 'format' => 'date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'created_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])], ['attribute' => 'updated_at', 'format' => 'date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'updated_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])]]]; $boxButtons = $actions = []; $showActions = false; //if (Yii::$app->user->can('BackendCreatePages')) { $boxButtons[] = '{create}'; //} //if (Yii::$app->user->can('BackendUpdatePages')) { $actions[] = '{update}'; $showActions = $showActions || true; //} //if (Yii::$app->user->can('BackendDeletePages')) { $boxButtons[] = '{batch-delete}'; $actions[] = '{delete}'; $showActions = $showActions || true; //} if ($showActions === true) {