public function run() { $scheme = $this->model->{$this->attribute}; $dm = new DynModel(); $dm->schemeFromJson($scheme); return $this->render('editor', ['model' => $dm]); }
private function _getFieldEditor() { $id = Yii::$app->request->post('id'); $params = Yii::$app->request->post('params'); $dm = new DynModel(); $dm->schemeFromArray($params['model']); $fld = $dm->getField($id); if (!$fld) { return ['status' => 'error', 'message' => Yii::t('dynModel', 'Неверный идентификатор поля.')]; } return ['status' => 'ok', 'title' => Yii::t('dynModel', 'Новое поле'), 'html' => $this->renderFile(__DIR__ . '/../views/field_editor.php', ['model' => $fld])]; }