当前位置: 首页>>代码示例>>PHP>>正文


PHP FormHelper::input方法代码示例

本文整理汇总了PHP中FormHelper::input方法的典型用法代码示例。如果您正苦于以下问题:PHP FormHelper::input方法的具体用法?PHP FormHelper::input怎么用?PHP FormHelper::input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FormHelper的用法示例。


在下文中一共展示了FormHelper::input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: input

 public function input($fieldName, $options = array())
 {
     if (isset($options['label']) && (!isset($options['label']['class']) || !empty($options['label']['class']))) {
         $options['label'] = array('class' => 'col-lg-2 control-label', 'text' => $options['label']);
     }
     return parent::input($fieldName, $options);
 }
开发者ID:KamiMoon,项目名称:volunteeromaha,代码行数:7,代码来源:Bootstrap3FormHelper.php

示例2: input

 function input($fieldName, $options = array())
 {
     if (isset($options['type']) && $options['type'] == 'hidden') {
         return parent::input($fieldName, $options);
     }
     return $this->divWrap(parent::input($fieldName, $options));
 }
开发者ID:kouak,项目名称:ircube,代码行数:7,代码来源:uni_form.php

示例3: input

 /**
  * Input redefinition - required class += required span
  * @link http://book.cakephp.org/view/1390/Automagic-Form-Elements
  */
 function input($fieldName, $options = array())
 {
     if (isset($options['class']) && strstr('required', $options['class'])) {
         $options['label'] .= $this->required();
     }
     return parent::input($fieldName, $options) . "\n";
 }
开发者ID:stripthis,项目名称:BlackRabbit,代码行数:11,代码来源:my_form.php

示例4: input

	public function input($fieldName, $options = array()) {

		if (!empty($options['type']) and ($options['type'] == 'submit')) {
            if ((!empty($options['label'])) and is_array($options['label'])) {
				$label['class'] = (!empty($label['class']))? 'control-label col-sm-2 '.$options['label']: 'control-label col-sm-2';
				$label['text'] = (!empty($label['text']))? $options['label']['text']: false;
			} else if (!empty($options['label'])) {
				$label['text'] = false;
				$label['class'] = 'control-label col-sm-2';
			}

			if (isset($label)) {
				$options['label'] = $label;
			}
			if (empty($options['class'])) $options['class'] = 'btn btn-danger';
		} else {
			if (!empty($options['class'])) $options['class'] = 'form-control '.$options['class'];
			if ((!empty($options['label'])) and is_array($options['label'])) {
				$options['label']['class'] = (!empty($options['label']['class']))? 'control-label col-sm-2 '.$options['label']['class']: 'control-label col-sm-2';
			} else if (!empty($options['label'])) {
				$label['text'] = $options['label'];
				$label['class'] = 'control-label col-sm-2';
				$options['label'] = $label;
			}
		}

		if (empty($options['between'])) $options['between'] = '<div class="col-sm-10">';
		if (!empty($options['after'])) $options['after'] = $options['after'].'</div></div> ';

		return parent::input($fieldName, $options);
	}
开发者ID:patrickacioli,项目名称:exames,代码行数:31,代码来源:FormTbHelper.php

示例5: input

 /**
  * Adds Bootstrap-style class name to datetime inputs
  * @param string $fieldName
  * @param array $options
  * @return string
  */
 public function input($fieldName, $options = array())
 {
     if (!isset($options['multiple'])) {
         // TODO : find a way to make select multiple change into multiple checkboxes
         //	$options['multiple'] = 'checkbox';
     }
     if (!isset($options['type'])) {
         $modelKey = $this->model();
         $fieldKey = $this->field();
         $fieldDef = $this->_introspectModel($modelKey, 'fields', $fieldKey);
         if (is_null($fieldDef)) {
             $options['multiple'] = 'checkbox';
         } else {
             if ($fieldDef['type'] == 'datetime') {
                 // Add "input-small" to class attribute
                 if (isset($options['class'])) {
                     $classes = explode(' ', $options['class']);
                     $classes[] = 'input-medium';
                     $options['class'] = implode(' ', $classes);
                 } else {
                     $options['class'] = 'input-medium';
                 }
             }
         }
     } else {
         if ($options['type'] == 'quantity') {
             $options['type'] = 'number';
             $options['pattern'] = '^[0-9]\\d*$';
         }
     }
     return parent::input($fieldName, $options);
 }
开发者ID:mathg,项目名称:skinsound,代码行数:38,代码来源:MyFormHelper.php

示例6: input

 function input($fieldName, $options = array())
 {
     if (!empty($this->params['named']) && !empty($this->params['named'][$fieldName])) {
         $options['value'] = $this->params['named'][$fieldName];
     }
     $fieldType = $fieldName;
     $pos = strrpos($fieldType, '.');
     if (!($pos === false)) {
         $fieldType = substr($fieldType, $pos + 1);
     }
     switch ($fieldType) {
         case "file":
         case "movie":
         case "image":
         case "thumbnail":
         case "thumb":
         case "logo":
         case "afbeelding":
         case "foto":
         case "photo":
             $options['type'] = 'file';
             break;
     }
     return parent::input($fieldName, $options);
 }
开发者ID:hafizubikm,项目名称:bakeme,代码行数:25,代码来源:extended_form.php

示例7: input

 public function input($fieldName, $options = array())
 {
     $defaults = array('before' => '', 'between' => '<div class="controls">', 'after' => '</div>', 'format' => array('before', 'label', 'between', 'input', 'error', 'after'), 'class' => $this->formSpan, 'div' => array('class' => 'control-group'), 'error' => array('attributes' => array('class' => 'help-block error', 'wrap' => 'span')), 'help' => '', 'required' => false, 'append' => array(), 'prepend' => array());
     $options = array_merge($defaults, $this->_inputDefaults, $options);
     if (isset($options['type']) && $options['type'] == 'radio') {
         $options['between'] = $options['after'] = '';
     }
     if (isset($options['help'])) {
         $options['after'] = '<p class="help-block">' . $options['help'] . '</p>' . $options['after'];
         unset($options['help']);
     }
     if (isset($options['actions'])) {
         $options['after'] .= '<div class="actions">' . join("\n", $options['actions']) . '</div>';
         unset($options['actions']);
     }
     if (!empty($options['prepend']) && empty($options['append'])) {
         $prepend = is_array($options['prepend']) ? join("\n", $options['prepend']) : '<span class="add-on">' . $options['prepend'] . '</span>';
         $options['between'] .= '<div class="input-prepend">' . $prepend;
         $options['after'] = '</div>' . $options['after'];
         unset($options['prepend']);
     } elseif (!empty($options['append']) && empty($options['prepend'])) {
         $append = is_array($options['append']) ? join("\n", $options['append']) : '<span class="add-on">' . $options['append'] . '</span>';
         $options['between'] .= '<div class="input-append">';
         $options['after'] = $append . '</div>' . $options['after'];
         unset($options['append']);
     } elseif (!empty($options['prepend']) && !empty($options['append'])) {
         $prepend = is_array($options['prepend']) ? join("\n", $options['prepend']) : '<span class="add-on">' . $options['prepend'] . '</span>';
         $append = is_array($options['append']) ? join("\n", $options['append']) : '<span class="add-on">' . $options['append'] . '</span>';
         $options['between'] .= '<div class="input-append input-prepend">' . $prepend;
         $options['after'] = $append . '</div>' . $options['after'];
         unset($options['prepend']);
         unset($options['append']);
     }
     return parent::input($fieldName, $options);
 }
开发者ID:josephbergdoll,项目名称:berrics,代码行数:35,代码来源:BootstrapFormHelper.php

示例8: input

 function input($fieldName, $options = array())
 {
     if (ClassRegistry::isKeySet($this->model())) {
         $model =& ClassRegistry::getObject($this->model());
         if ($model->isOrigamiColumn($fieldName)) {
             $type = $model->getOrigamiColumnType($fieldName);
             if (method_exists($this, $type)) {
                 unset($options['type']);
                 // We are specifying the type, so we need to remove any user specified types
                 $out = $this->{$type}($fieldName, $options);
                 // The code is this section is mostly copied from the cake php
                 // FormHelper input method
                 $div = true;
                 $divOptions = array();
                 if (array_key_exists('div', $options)) {
                     $div = $options['div'];
                     unset($options['div']);
                 }
                 if (!empty($div)) {
                     $divOptions['class'] = 'input';
                     $divOptions = $this->addClass($divOptions, $type);
                     if (is_string($div)) {
                         $divOptions['class'] = $div;
                     } elseif (is_array($div)) {
                         $divOptions = array_merge($divOptions, $div);
                     }
                     if (in_array($this->field(), $this->fieldset['validates'])) {
                         $divOptions = $this->addClass($divOptions, 'required');
                     }
                     if (!isset($divOptions['tag'])) {
                         $divOptions['tag'] = 'div';
                     }
                 }
                 if ($type != 'hidden') {
                     $error = null;
                     if (isset($options['error'])) {
                         $error = $options['error'];
                         unset($options['error']);
                     }
                     if ($error !== false) {
                         $errMsg = $this->error($fieldName, $error);
                         if ($errMsg) {
                             $out .= $errMsg;
                             $divOptions = $this->addClass($divOptions, 'error');
                         }
                     }
                 }
                 if (isset($divOptions) && isset($divOptions['tag'])) {
                     $tag = $divOptions['tag'];
                     unset($divOptions['tag']);
                     $out = $this->Html->tag($tag, $out, $divOptions);
                 }
                 // end cake php inputs copy
                 return $out;
             }
         }
     }
     return parent::input($fieldName, $options);
 }
开发者ID:busytoby,项目名称:gitrbug,代码行数:59,代码来源:origami_form.php

示例9: tweet

 /**
  * create tweet box
  *
  * @param $fieldName
  * @param $options
  *      type: element type (default: textarea)
  *      maxLength:   text max length (default: 140)
  *      counterText: length message
  *      submit: submit button message. if set to false, not create.
  *      jqueryCharCount: path to charCount.js (jquery plugin)
  *      other keys set to input element options.
  */
 public function tweet($fieldName, $options = array())
 {
     $this->setEntity($fieldName);
     $domId = !empty($options['id']) ? $options['id'] : $this->domId($fieldName);
     $default = array('type' => 'textarea', 'maxlength' => 140, 'jqueryCharCount' => '/twitter_kit/js/charCount.js', 'counterText' => __d('twitter_kit', 'Characters left: ', true), 'submit' => __d('twitter_kit', 'Tweet', true));
     $options = am($default, $options);
     $inputOptions = $options;
     unset($inputOptions['jqueryCharCount']);
     unset($inputOptions['counterText']);
     unset($inputOptions['submit']);
     $out = $this->Html->script($options['jqueryCharCount']);
     $out .= $this->Form->input($fieldName, $inputOptions);
     $out .= $this->Js->buffer("\n            \$('#{$domId}').charCount({\n                limit: {$options['maxlength']},\n                counterText: '{$options['counterText']}',\n                exceeded: function(element) {\n                    \$('#{$domId}Submit').attr('disabled', true);\n                },\n                allowed: function(element) {\n                    \$('#{$domId}Submit').removeAttr('disabled');\n                }\n            });\n        ");
     if ($options['submit']) {
         $out .= $this->Form->submit($options['submit'], array('id' => $domId . 'Submit'));
     }
     return $this->output($out);
 }
开发者ID:hiromi2424,项目名称:twitter_kit,代码行数:30,代码来源:twitter.php

示例10: input

 public function input($fieldName, $options = array())
 {
     $this->setEntity($fieldName);
     $model = $this->_getModel($this->model());
     $fieldKey = $this->field();
     if (!@$options['type'] && $model->hasMethod('cloudinaryFields') && in_array($fieldKey, $model->cloudinaryFields())) {
         $options['type'] = 'file';
     }
     return parent::input($fieldName, $options);
 }
开发者ID:cloudinary,项目名称:cloudinary_cake_php,代码行数:10,代码来源:CloudinaryHelper.php

示例11: input

 public function input($fieldName, $options = array())
 {
     $this->setEntity($fieldName);
     $options = $this->_parseOptions($options);
     if ($options['type'] == 'checkbox') {
         $options['format'] = array('before', 'label', 'between', 'input', 'after', 'error');
     } elseif ($options['type'] == 'text' || $options['type'] == 'textarea') {
         $options = array_merge(array('class' => 'input-xxlarge'), $options);
     }
     return parent::input($fieldName, $options);
 }
开发者ID:Fyr,项目名称:yday,代码行数:11,代码来源:PHFormHelper.php

示例12: input

 public function input($fieldName, $options = array())
 {
     $options += $this->_inputDefaults + array('div' => 'form-field', 'class' => 'input-text medium', 'error' => array('attributes' => array('wrap' => 'small')));
     if ($options['class'] !== 'input-text') {
         $options['class'] .= ' input-text';
     }
     if (!empty($options['error']) && empty($options['error']['attributes']['wrap'])) {
         $options['error']['attributes']['wrap'] = 'small';
     }
     return parent::input($fieldName, $options);
 }
开发者ID:jmillerdesign,项目名称:foundation,代码行数:11,代码来源:FoundationFormHelper.php

示例13: editor

 /**
  * Create a input with CKEditor
  *
  * @param string $name - field name
  * @param array $options - input options
  * @return string
  */
 public function editor($fieldName, $options = array())
 {
     $this->Html->script('vendor/ckeditor/ckeditor', array('inline' => false));
     $this->Html->css('/js/vendor/ckeditor/fixes', array('inline' => false));
     $options = array_merge(array('class' => 'ckeditor'), $options);
     //
     // $options['class'] = 'ckeditor '.$options['class'];
     if (isset($options['fullwidth']) && $options['fullwidth']) {
         return '<div class="control-group"><div class="clearfix"></div><div class="shadow text-center">' . $this->textarea($fieldName, $options) . '</div></div>';
     }
     return parent::input($fieldName, $options);
 }
开发者ID:Mirocow,项目名称:gpz,代码行数:19,代码来源:PHFormHelper.php

示例14: input

 public function input($fieldName, $options = array())
 {
     $fieldNameShort = $fieldName;
     if (strstr($fieldName, '.')) {
         $fullName = explode('.', $fieldName);
         $model = $fullName[0];
         $fieldNameShort = end($fullName);
     }
     $defaults = array('placeholder' => Inflector::humanize($fieldNameShort));
     $options = Set::merge($defaults, $options);
     return parent::input($fieldName, $options);
 }
开发者ID:jet77,项目名称:DiabeteSavior,代码行数:12,代码来源:BootstrapFormHelper.php

示例15: input

 public function input($fieldName, $options = array())
 {
     if (isset($options['label']) && is_string($options['label'])) {
         $option['text'] = $options['label'];
         $options['label'] = array_merge($option, $this->_inputDefaults['label']);
     } else {
         if (isset($options['label']['text']) && !isset($options['label']['class'])) {
             $options['label'] = array_merge($options['label'], $this->_inputDefaults['label']);
         }
     }
     return parent::input($fieldName, $options);
 }
开发者ID:ristorantino,项目名称:ristorantino,代码行数:12,代码来源:BootstrapFormHelper.php


注:本文中的FormHelper::input方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。