本文整理匯總了PHP中Zend_View_Interface::formErrors方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_View_Interface::formErrors方法的具體用法?PHP Zend_View_Interface::formErrors怎麽用?PHP Zend_View_Interface::formErrors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_View_Interface
的用法示例。
在下文中一共展示了Zend_View_Interface::formErrors方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _recurseForm
/**
* Recurse through a form object, rendering errors
*
* @param Zend_Form $form
* @param Zend_View_Interface $view
* @return string
*/
protected function _recurseForm(Zend_Form $form, 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 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 Zend_Form && !$this->ignoreSubForms()) {
$content .= $this->getMarkupListStart() . $this->_recurseForm($subitem, $view) . $this->getMarkupListEnd();
}
}
}
return $content;
}
示例2: _recurseForm
/**
* Recurse through a form object, rendering errors
*
* @param Zend_Form $form
* @param Zend_View_Interface $view
* @return string
*/
protected function _recurseForm(Zend_Form $form, Zend_View_Interface $view)
{
$content = '';
$errors = $form->getMessages();
if ($form instanceof Zend_Form_SubForm || @$form->isSubForm) {
$name = $form->getName();
if (1 == count($errors) && array_key_exists($name, $errors)) {
$errors = $errors[$name];
}
}
if (empty($errors)) {
return $content;
}
foreach ($errors as $name => $list) {
$element = $form->{$name};
if (null === $element && is_numeric($name)) {
$content .= $this->getMarkupListItemStart() . $view->formErrors((array) $list, $this->getOptions()) . $this->getMarkupListItemEnd();
} else {
if ($element instanceof Zend_Form_Element) {
$element->setView($view);
$content .= $this->getMarkupListItemStart() . ($this->_skipLabels ? '' : $this->renderLabel($element, $view)) . $view->formErrors($list, $this->getOptions()) . $this->getMarkupListItemEnd();
} elseif (!$this->ignoreSubForms() && $element instanceof Zend_Form) {
$content .= $this->_recurseForm($element, $view);
}
}
}
return $content;
}