/** * Recurse through a form object, rendering errors * * @param IfwPsn_Vendor_Zend_Form $form * @param IfwPsn_Vendor_Zend_View_Interface $view * @return string */ protected function _recurseForm(IfwPsn_Vendor_Zend_Form $form, IfwPsn_Vendor_Zend_View_Interface $view) { $content = ''; $custom = $form->getCustomMessages(); if ($this->getShowCustomFormErrors() && count($custom)) { $content .= $this->getMarkupListItemStart() . $view->formErrors($custom, $this->getOptions()) . $this->getMarkupListItemEnd(); } foreach ($form->getElementsAndSubFormsOrdered() as $subitem) { if ($subitem instanceof IfwPsn_Vendor_Zend_Form_Element && !$this->getOnlyCustomFormErrors()) { $messages = $subitem->getMessages(); if (count($messages)) { $subitem->setView($view); $content .= $this->getMarkupListItemStart() . $this->renderLabel($subitem, $view) . $view->formErrors($messages, $this->getOptions()) . $this->getMarkupListItemEnd(); } } else { if ($subitem instanceof IfwPsn_Vendor_Zend_Form && !$this->ignoreSubForms()) { $markup = $this->_recurseForm($subitem, $view); if (!empty($markup)) { $content .= $this->getMarkupListStart() . $markup . $this->getMarkupListEnd(); } } } } return $content; }