form = $form; $this->builder = $form->builder(); $this->initFields(); $this->initFormAttributes(); } /** * 设置标题. * * @param string $title * * @return $this */ public function title($title) { $this->title = $title; return $this; } /** * 显示底部内容. * * @return $this */ public function showFooter() { $this->ajax(true); $this->disableSubmitButton(false); $this->disableResetButton(false); return $this; } /** * 在当前列增加一块表单. * * @param \Closure $callback * * @return $this */ public function next(\Closure $callback) { $this->layoutRow->column( 12, $form = $this->form ->builder() ->layout() ->form() ); $callback($form); return $this; } public function pushField(Field $field) { $field->attribute(Field::BUILD_IGNORE, true); $this->form->builder()->pushField((clone $field)->display(false)); $this->fields->push($field); if ($this->layout()->hasColumns()) { $this->layout()->addField($field); } $field->setForm($this->form); $field->setParent($this); $field->width($this->width['field'], $this->width['label']); $field::requireAssets(); return $this; } public function render() { $class = $this->title ? '' : 'pt-1'; $view = parent::render(); return << {$this->renderHeader()} {$view} HTML; } protected function renderHeader() { if (! $this->title) { return; } return <<

{$this->title}

HTML; } public function getKey() { return $this->form->getKey(); } public function model() { return $this->form->model(); } public function __call($method, $arguments) { try { return parent::__call($method, $arguments); } catch (RuntimeException $e) { return $this->form->$method($arguments); } } public function fillFields(array $data) { } }