/** * Renders validation errors (per form or per control). * @param IFormControl * @return string */ public function renderErrors(IFormControl $control = NULL) { $errors = $control === NULL ? $this->form->getErrors() : $control->getErrors(); if (count($errors)) { $ul = $this->getWrapper('error container'); $li = $this->getWrapper('error item'); foreach ($errors as $error) { $item = clone $li; if ($error instanceof Html) { $item->add($error); } else { $item->setText($error); } $ul->add($item); } return "\n" . $ul->render(0); } }