/** * {@inheritdoc} */ public function render() { $content = ''; foreach ($this->options as $option) { $content .= $option->render(); } return $this->tag->setHtmlContent($content)->render(); }
/** * Renders the errors of a Form or an Element as an unordered list. * * @param \Brick\Form\Base $base * @return string */ private function renderErrors(Base $base) { if (!$base->hasErrors()) { return ''; } $html = ''; foreach ($base->getErrors() as $error) { $li = new Tag('li'); $li->setTextContent($error); $html .= $li->render(); } $ul = new Tag('ul'); $ul->setHtmlContent($html); return $ul->render(); }
/** * @param \Brick\Form\Form $form * * @return string * * @throws \RuntimeException */ private function renderForm(Form $form) { $html = ''; foreach ($form->getComponents() as $component) { if ($component instanceof Element) { $html .= $this->renderElementAsRow($component); } elseif ($component instanceof Group) { foreach ($component->getElements() as $element) { $html .= $this->renderElementAsRow($element); } } } $table = new Tag('table'); $table->setAttribute('class', $this->class); $table->setHtmlContent($html); return $table->render(); }
/** * @param string $html * * @return static */ public function setHtmlContent($html) { $this->tag->setHtmlContent($html); return $this; }