本文整理汇总了PHP中Nette\Forms\Form::getOwnErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::getOwnErrors方法的具体用法?PHP Form::getOwnErrors怎么用?PHP Form::getOwnErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Forms\Form
的用法示例。
在下文中一共展示了Form::getOwnErrors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderGlobalErrors
/**
* @param bool $ownOnly - true = render only global errors, false = render all errors of all controls
* @return Html
*/
public function renderGlobalErrors($ownOnly = TRUE)
{
$errors = $ownOnly ? $this->form->getOwnErrors() : $this->form->getErrors();
$container = clone $this->prototypes->getGlobalErrors();
foreach ($errors as $error) {
$alert = clone $this->prototypes->getGlobalError();
$this->addContent($alert->getPlaceholder(), $error);
$container->getPlaceholder()->addHtml($alert);
}
return $container;
}
示例2: findErrors
/**
* @return array
*/
public function findErrors()
{
$formErrors = $this->errorsAtInputs ? $this->form->getOwnErrors() : $this->form->getErrors();
if (!$formErrors) {
return array();
}
$form = $this->form;
$translate = function ($errors) use($form) {
if ($translator = $form->getTranslator()) {
// If we have translator, translate!
foreach ($errors as $key => $val) {
$errors[$key] = $translator->translate($val);
}
}
return $errors;
};
return $translate($formErrors);
}
示例3: renderErrors
/**
* Renders validation errors (per form or per control).
* @return string
*/
public function renderErrors(Nette\Forms\IControl $control = NULL, $own = TRUE)
{
$errors = $control ? $control->getErrors() : ($own ? $this->form->getOwnErrors() : $this->form->getErrors());
if (!$errors) {
return;
}
$container = $this->getWrapper($control ? 'control errorcontainer' : 'error container');
$item = $this->getWrapper($control ? 'control erroritem' : 'error item');
foreach ($errors as $error) {
$item = clone $item;
if ($error instanceof Html) {
$item->add($error);
} else {
$item->setText($error);
}
$container->add($item);
}
return "\n" . $container->render($control ? 1 : 0);
}