本文整理汇总了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);
}
示例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);
}
示例3: error
function error($field, $text = null, $options = array())
{
$defaults = array('wrap' => true);
$options = array_merge($defaults, $options);
return parent::error($field, $text, $options);
}
示例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);
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}