/** * * {@inheritDoc} * * @see \Core\Html\HtmlBuildableInterface::build() */ public function build() { // No content, no output if (empty($this->content)) { throw new HtmlException('There is no content set for this panel.'); } foreach ($this->content as $content) { if ($content instanceof HtmlBuildableInterface || is_object($content) && method_exists($content, 'build')) { $content = $content->build(); } $this->html->addInner($content); } return $this->html->build(); }
/** * Builds the optiongroup control and returns the html code * * @see \Core\Html::build() * * @throws UnexpectedValueException * * @return string */ public function build() { if (empty($this->controls) && empty($this->inner)) { throw new ControlException('OptionGroup Control: No Options set.'); } /* @var $option \Core\Html\Form\Option */ foreach ($this->controls as $option) { if ($option instanceof \Core\Html\Elements\Heading) { $this->inner .= $option->build(); continue; } // Create name of optionelement $option_name = $this->getName() . '[' . $option->getValue() . ']'; $option_id = $this->getId() . '_' . $option->getValue(); $args = ['setName' => $option_name, 'setId' => $option_id, 'setValue' => $option->getValue(), 'addAttribute' => ['title' => $option->getInner()]]; // If value is greater 0 this checkbox is selected if ($option->getSelected()) { $args['isChecked'] = 1; } // Create checkox $control = $this->factory->create('Form\\Checkbox', $args); // Build control $this->inner .= ' <div class="checkbox"> <label>' . $control->build() . $option->getInner() . '</label> </div>'; } return parent::build(); }
public function build() { foreach ($this->groups as $group) { $this->inner .= $group->build(); } return parent::build(); }
public function build() { foreach ($this->buttons as $button) { $this->inner .= $button->build(); } return parent::build(); }
/** * (non-PHPdoc) * * @see \Core\Abstracts\AbstractHtml::build() */ public function build() { if ($this->use_panel == true) { // Bootstrap panel template $this->inner .= '<div class="panel panel-' . $this->panel_type . '">'; if (isset($this->heading_text)) { $this->inner .= '{heading}'; } $this->inner .= '<div class="panel-body">'; if (isset($this->description)) { $this->inner .= '{description}'; } if ($this->row) { $this->inner .= '<div class="row">'; } $this->inner .= '{content}</div>'; if ($this->row) { $this->inner .= '</div>'; } if (isset($this->footer)) { $this->inner .= '{footer}'; } $this->inner .= '</div>'; } else { if ($this->row) { $this->inner .= '<div class="row'; } if (isset($this->heading_text)) { $this->inner .= '{heading}'; } if (isset($this->description)) { $this->inner .= '{description}'; } $this->inner .= '{content}'; if (isset($this->footer)) { $this->inner .= '{footer}'; } if ($this->row) { $this->inner .= '</div>'; } } // Create possible heading if (isset($this->heading_text)) { // Heading: plain or withe BS title? $heading = '<h' . $this->heading_size . ($this->use_panel == true ? ' class="panel-title"' : '') . '>' . $this->heading_text . '</h' . $this->heading_size . '>'; // Replace heading in BS panel template... $this->inner = str_replace('{heading}', $this->use_panel == true ? '<div class="panel-heading">' . $heading . '</div>' : $heading, $this->inner); } // Is there a description do create? if (isset($this->description)) { // The description with small $description = '<p class="small">' . $this->description . '</p>'; // Into the panel template... $this->inner = str_replace('{description}', $description, $this->inner); } // Add the content $this->inner = str_replace('{content}', $this->content, $this->inner); if (isset($this->footer)) { $footer = '<span class="help-block">' . $this->description . '</span>'; $this->inner = str_replace('{footer}', $this->use_panel == true ? '<div class="panel-footer">' . $footer . '</div>' : $footer, $this->inner); } return parent::build(); }