/** * Renders validation errors (per form or per control). * @param \Nette\Forms\IControl $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 (count($errors)) { $wrapper = \Nette\Utils\Html::el('ul class="alert-box alert radius"'); $wrapper->addAttributes(array('data-alert' => '')); $wrapper->add('<a href="#" class="close">×</a>'); foreach ($errors as $error) { $item = \Nette\Utils\Html::el('li'); $item->setHtml($error); $wrapper->add($item); } $blockWrapper = \Nette\Utils\Html::el('div class="large-12 columns"'); $blockWrapper->setHtml($wrapper); $rowWrapper = \Nette\Utils\Html::el('div class="row"'); $rowWrapper->setHtml($blockWrapper); return $rowWrapper->render(0); } }
public function renderControlErrors(IControl $control) { $container = clone $this->prototypes->getControlErrors(); foreach ($control->getErrors() as $error) { $el = clone $this->prototypes->getControlError(); $this->addContent($el->getPlaceholder(), $error); $container->getPlaceholder()->addHtml($el); } return $container; }
/** * Renders validation errors (per form or per control). * @return string */ public function renderErrors(Nette\Forms\IControl $control = NULL) { $errors = $control === NULL ? $this->form->getErrors() : $control->getErrors(); if (count($errors)) { $ul = $this->getWrapper('error container'); $li = $this->getWrapper('error item'); foreach ($errors as $error) { $item = clone $li; if ($error instanceof Html) { $item->add($error); } else { $item->setText($error); } $ul->add($item); } return "\n" . $ul->render(0); } }
/** * 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); }
Nette\Forms\Controls\HiddenField&&!$control->getOption('rendered')){$s.=(string)$control->getControl();}}if(iterator_count($this->form->getComponents(TRUE,'Nette\Forms\Controls\TextInput'))<2){$s.='<!--[if IE]><input type=IEbug disabled style="display:none"><![endif]-->';}if($s){$s=$this->getWrapper('hidden container')->setHtml($s)."\n";}return$s.$this->form->getElementPrototype()->endTag()."\n";}function renderErrors(Nette\Forms\IControl$control=NULL){$errors=$control===NULL?$this->form->getErrors():$control->getErrors();if(count($errors)){$ul=$this->getWrapper('error container');$li=$this->getWrapper('error item');foreach($errors as$error){$item=clone$li;if($error instanceof Html){$item->add($error);}else{$item->setText($error);}$ul->add($item);}return"\n".$ul->render(0);}}function