/** * Add form element to layout element * * @param FormElement $formElement * @return FormLayoutAbstract */ public function addFormElement(FormElement $formElement) { $formElement->setParentLayout($this); $captionContainer = $this->_createCaptionContainer($formElement); $inputContainer = $this->_createInputContainer($formElement); $errorContainer = null; if ($formElement->getErrorMessage() != null && $this->_errorTagName != null) { $errorContainer = new HtmlElement($this->_errorTagName); $errorContainer->addClass($this->_errorClass); $errorContainer->setText($formElement->getErrorMessage()); $inputContainer->addElement($errorContainer); } $this->addFormElementContainer($inputContainer, $captionContainer, $errorContainer); return $this; }