public function actionUpdate($id) { $this->fieldGroup->scenario = 'admin-update'; if ($this->fieldGroup->load(Yii::$app->request->post())) { if ($this->fieldGroup->save()) { return $this->redirect(Url::toRoute('index')); } } return $this->render('update', ['model' => $this->fieldGroup]); }
?> <?php echo $form->field($model, 'show_unit')->checkbox(); ?> <?php echo $form->field($model, 'type')->dropDownList(CategoryField::types()); ?> <?php echo $form->field($model, 'options')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'group_id')->dropDownList(\yii\helpers\ArrayHelper::map(CategoryFieldGroup::find()->all(), 'id', 'title_system')); ?> <?php echo $form->field($model, 'required')->checkbox(); ?> <?php echo $form->field($model, 'hidden')->checkbox(); ?> <?php echo $form->field($model, 'sort'); ?> <?php
<?php use yii\widgets\ActiveForm; use yii\helpers\Html; use yii\helpers\ArrayHelper; /** * @var \yii\easyii\modules\catalog\models\Category2CategoryField $model */ ?> <?php $form = ActiveForm::begin([]); echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map(\yii\easyii\modules\catalog\models\Category::find()->all(), 'id', 'title')); ?> <?php echo $form->field($model, 'field_group_id')->dropDownList(ArrayHelper::map(\yii\easyii\modules\catalog\models\CategoryFieldGroup::find()->all(), 'id', 'title_system')); ?> <?php echo Html::submitButton(Yii::t('easyii', 'Save'), ['class' => 'btn btn-primary']); ?> <?php ActiveForm::end();