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(); }
/** * Render * * @access public * @return string */ public function render(array $attr = array()) { if (!empty($this->_rows)) { // Set Table Caption if (!empty($this->_caption)) { $output[] = $this->_caption; } // Set Table Headers $thead = new Tag('tr'); foreach ($this->_headers as $column) { $thead->append_content(new Tag('th', $column)); } $output[] = new Tag('thead', $thead->render()); // Set Table Body $output[] = new Tag('tbody', implode(PHP_EOL, $this->_rows)); // Set Table Footers if (!empty($this->_footers)) { $tfoot = new Tag('tr'); foreach ($this->_footers as $column) { $tfoot->append_content(new Tag('th', $column)); } $output[] = new Tag('tfoot', $tfoot); } $table = new Tag($this->_tag, implode(PHP_EOL, $output), $this->_attributes); if ($this->_is_responsive) { return (new Tag('div', $table, ['class' => 'table-responsive']))->render(); } return $table->render(); } return ''; }