public function run() { $fields = $this->model->modelFields(); $form = ActiveForm::begin(ArrayHelper::merge(['layout' => 'horizontal'], $this->formOptions)); /** @var $field \gromver\models\fields\BaseField */ foreach ($fields as $field) { $this->parts['{field}'] = $field->field($form, $form->fieldConfig); echo strtr($this->template, $this->parts); //echo $field->field($form, $form->fieldConfig); } ActiveForm::end(); $this->getView()->registerAssetBundle(ModelFormAsset::className()); }
/** * @inheritdoc */ public function __unset($name) { if (array_key_exists($name, $this->_attributes)) { unset($this->_attributes[$name]); } else { parent::__unset($name); } }
/** * Пляски с бубнами для того чтоб валидация нармально отрабатывала атрибуты с числовыми именами * @inheritdoc */ public function activeAttributes() { return array_map(function ($value) { return (string) $value; }, parent::activeAttributes()); }