= Html::a(Yii::t('languages','Create Language'), ['create'], ['class' => 'btn btn-success']) ?>
= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
[
'attribute' => 'default',
'format' => 'raw',
'value' => function(Language $language) {
return Html::a(LanguageHelper::defaultLabel($language->default), ['set-default', 'id' => $language->id], [
'data' => [
'confirm' => Yii::t('languages', 'Are you sure you want to set this language as default?'),
'method' => 'post',
],
]);
},
'options' => ['style' => 'width: 150px;'],
'contentOptions' => ['class' => 'text-center'],
],
[
'attribute' => 'title',
'value' => function (Language $model) {
return Html::a(Html::encode($model->title), ['view', 'id' => $model->id]);
},
'format' => 'raw',
],
'name',
[
'attribute' => 'status',
'filter' => LanguageHelper::statusList(),
'format' => 'raw',
'value' => function(Language $language) {
return LanguageHelper::statusLabel($language->status);
},
'options' => ['style' => 'width: 150px;'],
'contentOptions' => ['class' => 'text-center'],
],
[
'class' => ActionColumn::class,
'visibleButtons' => [
'delete' => function ($model, $key, $index) {
return $model->default === 1 ? false : true;
}
],
'options' => ['style' => 'width: 100px;'],
'contentOptions' => ['class' => 'text-center'],
],
],
]); ?>