当前位置: 首页>>代码示例>>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;未经允许,请勿转载。