Код: Выделить всё
....................................................
[
'label' => "Тип",
'attribute' => 'type',
'value' => function($data) {
return $data["type"];
},
],
....................................................
Список тот же. что и во view:
Код: Выделить всё
<?php $form = ActiveForm::begin(['id' => 'edit-form'
]); ?>
<?= $form->field($model, 'name')->textInput(['autofocus' => true])->label('Имя') ?>
<?= $form->field($model, 'type')->dropDownList([
'1' => 'Тип 1',
'2' => 'Тип 2',
'3' => 'Тип 3',
])->label('Роль') ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-primary',]) ?>
</div>
<?php ActiveForm::end(); ?>