/** * 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(); }
/** * {@inheritdoc} */ public function render() { return $this->tag->setTextContent($this->content)->render(); }
/** * @param string $text * * @return static */ public function setTextContent($text) { $this->tag->setTextContent($text); return $this; }