} if ($model->isNewRecord) { $config = $model->getFormConfig(); } /* @var $this yii\web\View */ /* @var $model backend\models\view\Page */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="page-form" style="padding-top: 10px;"> <?php $form = FormBuilder::begin(); ?> <?php echo $form->renderForm($model, $config); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php FormBuilder::end(); ?> </div>
<?php $items = []; $content = null; foreach ($values as $value) { $attribute = '[' . $value->id . ']value'; $configuration = $value->getValueFieldConfig(); $configuration['label'] = $value->description . ' [key: ' . $value->id . '] [language: ' . LanguageHelper::getCurrent()->code . ']'; $content .= $form->renderField($value, $attribute, $configuration); if ($value instanceof \common\components\model\Translateable && $value->isTranslateAttribute($attribute)) { foreach ($value->getTranslationModels() as $languageModel) { $configuration['label'] = $value->description . ' [key: ' . $value->id . '] [language: ' . $languageModel->language . ']'; $content .= $form->renderField($languageModel, '[' . $languageModel->language . ']' . $attribute, $configuration); } } } echo $content; ?> <div class="form-group"> <?php echo Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-success']); ?> </div> <?php \metalguardian\formBuilder\ActiveFormBuilder::end(); ?> </div>