Файл: cachy/plugin/function.error.php
Строк: 44
<?php
function smarty_function_error( $params )
{
if ( !isset($params['name']) )
{
throw new InvalidArgumentException('Empty input name!');
}
$vr = PEEP_ViewRenderer::getInstance();
/* @var $form Form */
$form = $vr->getAssignedVar('_peepActiveForm_');
if ( !$form )
{
throw new InvalidArgumentException('There is no form for input `' . $params['name'] . '` !');
}
$input = $form->getElement(trim($params['name']));
if ( $input === null )
{
throw new WarningException('No input named `' . $params['name'] . '` in form !');
}
$errors = $input->renderErrors();
return UTIL_HtmlTag::generateTag('span', array('id' => $input->getId() . '_error', 'style' => ( $errors ? 'display:block;' : 'display:none;' ), 'class' => 'error'), true, $errors);
}