public function render() { switch ($this->_fieldset_type) { case self::PANEL_FIELDSET: $fieldset = new Panel(Panel::DEFAULT_PANEL, $this->_attributes); $this->legend->append_content((new Link(['class' => 'panel-collapse pull-right']))->set_icon('fa fa-chevron-up')); $fieldset->set_title($this->legend); if ($this->_group_type === Form::HORIZONTAL_FORM) { $fieldset->add_class('form-horizontal'); } elseif ($this->_group_type === Form::VERTICAL_FORM) { $fieldset->add_class('form-vertical'); } elseif ($this->_group_type === Form::INLINE_FORM) { $fieldset->add_class('form-inline'); } break; default: $fieldset = new Tag($this->_tag, $this->_attributes); break; } $fieldset->set_body(implode(PHP_EOL, $this->_items)); return $fieldset->render(); }