/** * @inheritdoc */ public function get() { $this->model = Instance::ensure($this->model); if (!$this->model->isLoad()) { $this->validate = false; } if ($this->validate === true) { $this->prepareAttributes(); if (!$this->model->validate()) { $this->errorsToPlaceholders($this->model); } } $this->config['model'] = $this->model; ob_start(); $form = \rock\widgets\ActiveForm::begin($this->config); $output = ob_get_clean(); $fields = []; $fields[] = $output; if (!empty($this->fields)) { $this->prepareFields($form, (array) $this->fields, $fields); } $fields[] = $this->prepareSubmitButton($this->submitButton); ob_start(); ob_implicit_flush(false); \rock\widgets\ActiveForm::end(); $output = ob_get_clean(); $fields[] = $output; $result = implode("\n", $fields); // Inserting content into wrapper template (optional) if (!empty($this->wrapperTpl)) { $result = $this->parseWrapperTpl($result, $this->wrapperTpl); } // To placeholder if (!empty($this->toPlaceholder)) { $this->template->addPlaceholder($this->toPlaceholder, $result, true); $this->template->cachePlaceholders[$this->toPlaceholder] = $result; return ''; } return $result; }