form = $form; $this->builder = $form->builder(); $this->initFields(); $this->initFormAttributes(); } public function title($title) { $this->title = $title; return $this; } /** * Add a form field to form. * * @param Field $field * * @return $this */ public function pushField(Field &$field) { $this->form->builder()->fields()->push($field); $this->fields->push($field); $field->attribute(Builder::BUILD_IGNORE, true); $field->setForm($this->form); $field->width($this->width['field'], $this->width['label']); $field::collectAssets(); return $this; } public function render() { $view = Helper::render(parent::render()); $style = $this->title ? '' : 'padding-top: 13px'; return << {$this->renderHeader()} {$view} HTML; } protected function renderHeader() { if (! $this->title) { return; } return <<

{$this->title}

HTML; } }