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


PHP FormHelper::error方法代碼示例

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


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

示例1: error

 /**
  * Adds Bootstrap-style class name to error messages
  * @param string $field
  * @param null $text
  * @param array $options
  * @return string
  */
 public function error($field, $text = null, $options = array())
 {
     if (!empty($this->request->params['admin'])) {
         $options['class'] = 'help-inline';
     }
     return parent::error($field, $text, $options);
 }
開發者ID:mathg,項目名稱:skinsound,代碼行數:14,代碼來源:MyFormHelper.php

示例2: error

 /**
  * Render error messages
  *
  * @param string $field
  * @param mixed $text
  * @param array $options
  *
  * @return string
  */
 public function error($field, $text = null, $options = array())
 {
     // The only way currently to catch Model Relation validation errors :(
     if ($field[0] == ucfirst($field[0])) {
         $field = sprintf('%s.%s', $this->_modelScope, $field);
     }
     return parent::error($field, $text, $options);
 }
開發者ID:josephbergdoll,項目名稱:berrics,代碼行數:17,代碼來源:BootstrapFormHelper.php

示例3: error

 function error($field, $text = null, $options = array())
 {
     $defaults = array('wrap' => true);
     $options = array_merge($defaults, $options);
     return parent::error($field, $text, $options);
 }
開發者ID:tsmsogn,項目名稱:xformHelper,代碼行數:6,代碼來源:xform.php

示例4: error

 /**
  *
  * Create & return a error message (Twitter Bootstrap like).
  *
  * The error is wrapped in a <span> tag, with a class
  * according to the form type (help-inline or help-block).
  *
  **/
 public function error($field, $text = null, $options = array())
 {
     $this->setEntity($field);
     $optField = $this->_magicOptions(array());
     $options['wrap'] = $this->_extractOption('wrap', $options, 'span');
     $errorClass = 'help-block';
     if ($this->horizontal && $optField['type'] != 'checkbox' && $optField['type'] != 'radio') {
         $errorClass .= ' ' . $this->_getColClass('error');
     }
     $options = $this->addClass($options, $errorClass);
     return parent::error($field, $text, $options);
 }
開發者ID:tsmsogn,項目名稱:cakephp-bootstrap3-helpers,代碼行數:20,代碼來源:BootstrapFormHelper.php

示例5: error

 public function error($field, $options = array(), $text = NULL)
 {
     $commons['escape'] = false;
     $commons['wrap'] = false;
     return parent::error($field, $text, array_merge($commons, $options));
 }
開發者ID:ribaslucian,項目名稱:php-cakephp-2.x-base,代碼行數:6,代碼來源:SemanticFormHelper.php

示例6: _clearfix

 protected function _clearfix($name, $input, $options)
 {
     $default = array('label' => null, 'type' => null, 'div' => array('class' => 'controls'));
     $options = Set::merge($default, $options);
     $out = array();
     if ($options['label'] !== false) {
         $text = $options['label']['text'];
         if ($options['type'] === 'checkbox') {
             unset($options['label']['text']);
             $options['label']['for'] = '';
         }
         $out[] = parent::label(FALSE, $text, $options['label']);
     }
     $out[] = $this->Html->div($options['div']['class'], $input, $options['div']);
     $clearfix = 'control-group';
     if (parent::error($name)) {
         $clearfix .= ' error';
     }
     return $this->Html->div($clearfix, implode("\n", $out));
 }
開發者ID:nano-eight,項目名稱:TwitterBootstrap,代碼行數:20,代碼來源:BootstrapFormHelper.php

示例7: error

 /**
  * Adds the class `help-inline` as its required by bootstrap
  *
  */
 public function error($field, $text = null, $options = array())
 {
     $defaults = array('class' => 'help-inline');
     $options = Set::merge($defaults, $options);
     return parent::error($field, $text, $options);
 }
開發者ID:wangshipeng,項目名稱:license,代碼行數:10,代碼來源:BootstrapFormHelper.php

示例8: error

 /**
  * @link http://book.cakephp.org/view/1423/error
  */
 function error($field, $text = null, $options = array())
 {
     $defaults = array('wrap' => 'p', 'class' => 'message error', 'escape' => true);
     $options = array_merge($defaults, $options);
     return parent::error($field, $text, $options);
 }
開發者ID:stripthis,項目名稱:BlackRabbit,代碼行數:9,代碼來源:my_form.php

示例9: error

 /**
  * Create & return a error message (Twitter Bootstrap like).
  * 
  * The error is wrapped in a <span> tag, with a class
  * according to the form type (help-inline or help-block).
  *
  * @param string $field Field name.
  * @param string $text Error message.
  * @param array $options Array of options to passed to parent::error().
  * @return string HTML string of the error message for the field.
  */
 public function error($field, $text = null, $options = [])
 {
     $this->setEntity($field);
     $optField = $this->_magicOptions([]);
     $options['wrap'] = $this->_extractOption('wrap', $options, 'span');
     $errorClass = GA_HELP_BLOCK;
     if ($this->formType === GA_INLINE) {
         $errorClass = GA_HELP_INLINE;
     }
     $options = $this->addClass($options, $errorClass);
     return parent::error($field, $text, $options);
 }
開發者ID:gezeresolutionsweb,項目名稱:cakeganache,代碼行數:23,代碼來源:GanacheFormHelper.php

示例10: multipleSelectBoxes

 function multipleSelectBoxes($fieldName, $options = array())
 {
     $label = null;
     if (!empty($options['label'])) {
         $label = $options['label'];
     }
     $options['label'] = false;
     $model = $this->model();
     $view =& ClassRegistry::getObject('view');
     $this->setEntity($fieldName);
     $tr_class = '';
     if (in_array($this->field(), $this->fieldset['validates'])) {
         $tr_class = ' class="required"';
     }
     $out = '';
     $out .= '<tr' . $tr_class . '>';
     $out .= '<th>';
     $out .= parent::label($fieldName, $label);
     $out .= '</th>';
     $out .= '<td>';
     $options['div'] = false;
     $varName = Inflector::variable(Inflector::pluralize(preg_replace('/_id$/', '', $this->field())));
     $users = $view->getVar($varName);
     $selects = array();
     $attributes = $this->value($options);
     if (!empty($attributes['value'])) {
         foreach ($attributes['value'] as $selected) {
             $selects[$selected] = $users[$selected];
             unset($users[$selected]);
         }
     }
     if (!empty($options['options'])) {
         $selects = $options['options'];
         $key = key($options['options']);
         unset($users[$key]);
         unset($options['options']);
     }
     $out .= parent::input($fieldName, array_merge($options, array('options' => $selects, 'error' => false)));
     $out .= parent::input('all', array_merge($options, array('type' => 'select', 'options' => $users, 'error' => false)));
     $out .= parent::error($fieldName);
     $script = 'createMovableOptions("' . $model . 'All","' . $fieldName . $fieldName . '",500,300,"' . __d('tools', $fieldName, true) . '","' . $label . '");';
     $out .= $this->Javascript->codeBlock($script, array('inline' => true));
     $this->Javascript->link('multipleselectboxes.js', false);
     $this->Html->css('multipleselectboxes.css', null, array(), false);
     $out .= '</td>';
     $out .= '</tr>';
     return $out;
 }
開發者ID:masayukiando,項目名稱:googlemap-search_ActionScript3.0,代碼行數:48,代碼來源:app_form.php


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