當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IControl::getErrors方法代碼示例

本文整理匯總了PHP中Nette\Forms\IControl::getErrors方法的典型用法代碼示例。如果您正苦於以下問題:PHP IControl::getErrors方法的具體用法?PHP IControl::getErrors怎麽用?PHP IControl::getErrors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\Forms\IControl的用法示例。


在下文中一共展示了IControl::getErrors方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: renderErrors

 /**
  * 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">&times;</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);
     }
 }
開發者ID:r-st,項目名稱:foundation-form-renderer,代碼行數:24,代碼來源:Renderer.php

示例2: renderControlErrors

 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;
 }
開發者ID:instante,項目名稱:bootstrap3renderer,代碼行數:10,代碼來源:BootstrapRenderer.php

示例3: renderErrors

 /**
  * 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);
     }
 }
開發者ID:svobodni,項目名稱:web,代碼行數:22,代碼來源:DefaultFormRenderer.php

示例4: 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);
 }
開發者ID:luminousinfoways,項目名稱:pccfoas,代碼行數:23,代碼來源:DefaultFormRenderer.php

示例5:

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
開發者ID:JanTvrdik,項目名稱:NetteExtras,代碼行數:5,代碼來源:loader.php


注:本文中的Nette\Forms\IControl::getErrors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。