本文整理汇总了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;
}