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


PHP FormBuilder::input方法代码示例

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


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

示例1: input

 /**
  * Create a form input field.
  *
  * @param string                         $type
  * @param string                         $name
  * @param string                         $value
  * @param string                         $label
  * @param \Illuminate\Support\MessageBag $errors
  * @param array                          $options
  * @param array                          $parameters
  *
  * @return string
  */
 protected function input($type = 'text', $name, $label = null, $value = null, $errors = null, array $options = array(), array $parameters = array())
 {
     $options = array_merge(array('class' => 'form-control', 'placeholder' => $label), $options);
     $return = $this->group($name, $errors);
     $return .= $this->label($name, $label);
     if (!$value) {
         $value = $this->input->get($name);
     }
     if ($this->formType == self::FORM_HORIZONTAL) {
         $return .= $this->group('', null, $this->inputClass);
     }
     switch ($type) {
         case 'datetime':
         case 'date':
         case 'time':
             $return .= '<div id="' . $name . '_' . $type . '" class="input-group ' . $type . '">';
             $return .= $this->form->text($name, $value, $options);
             $return .= '<span class="input-group-addon">' . "\n" . '<span class="glyphicon glyphicon-' . ($type == 'time' ? 'time' : 'calendar') . '"></span>' . "\n" . '</span>' . "\n" . '</div>' . "\n";
             $return .= '<script type="text/javascript">$(function() { $("#' . $name . '_' . $type . '").datetimepicker({ ';
             switch ($type) {
                 case 'time':
                     $return .= 'pickDate: false, ';
                     break;
                 case 'date':
                     $return .= 'pickTime: false, ';
                     break;
                 case 'datetime':
                 default:
             }
             $return .= implode(', ', array_map(function ($value, $key) {
                 return $key . ': "' . $value . '"';
             }, $parameters, array_keys($parameters)));
             $return = rtrim($return, ', ');
             $return .= ' }); });</script>' . "\n";
             break;
         case 'password':
         case 'file':
             $return .= $this->form->{$type}($name, $options) . "\n";
             break;
         case 'text':
         case 'hidden':
         case 'email':
         case 'textarea':
             $return .= $this->form->{$type}($name, $value, $options) . "\n";
             break;
         default:
             $return .= $this->form->input($type, $name, $value, $options) . "\n";
     }
     $return .= $this->errors($name, $errors);
     if ($this->formType == self::FORM_HORIZONTAL) {
         $return .= '</div>' . "\n";
     }
     $return .= '</div>' . "\n";
     return $return;
 }
开发者ID:anisku11,项目名称:Laravel-SIG,代码行数:68,代码来源:BootstrapBase.php

示例2: textarea

 /**
  * Create a Textarea field.
  *
  * 
  * @param  string  $name
  * @param  string  $value
  * @param  array   $options
  * @param  string  $label
  * @return string
  */
 public function textarea($name, $value = null, $options = array(), $label = '')
 {
     if (!self::$is_bootstrap || in_array($name, self::$excluded)) {
         return parent::input($type, $name, $value, $options);
     }
     $label_text = $label == '' ? $this->transformKey($name) : $label;
     $options = $this->appendClassToOptions('form-control', $options);
     // Call the parent input method so that Laravel can handle
     // the rest of the input set up.
     return $this->openGroup($name, $label_text) . parent::textarea($name, $value, $options) . $this->closeGroup($name);
 }
开发者ID:shyam-achuthan,项目名称:laravel5bootstrap3form,代码行数:21,代码来源:FormBuilder.php

示例3: input

 public function input($type, $name, $value = null, $options = array())
 {
     $defaults = array();
     if ($type !== "file") {
         if (array_key_exists("class", $options)) {
             $options["class"] = "form-control " . $options['class'];
         } else {
             $defaults["class"] = "form-control";
         }
     }
     $options = array_merge($defaults, $options);
     return parent::input($type, $name, $value, $options);
 }
开发者ID:h0akd,项目名称:bootstrapform,代码行数:13,代码来源:BootstrapForm.php

示例4: input

 /**
  * Create a form input field.
  *
  * @param string $type
  * @param string $name
  * @param string $value
  * @param array $options
  * @return string 
  * @static 
  */
 public static function input($type, $name, $value = null, $options = array())
 {
     return \Illuminate\Html\FormBuilder::input($type, $name, $value, $options);
 }
开发者ID:nmkr,项目名称:basic-starter,代码行数:14,代码来源:_ide_helper.php

示例5: input

 /**
  * {@inheritdoc}
  */
 public function input($type, $name, $value = null, $options = [])
 {
     $options = array_merge($options, $this->parsley->getFieldRules($name));
     return parent::input($type, $name, $value, $options);
 }
开发者ID:idma,项目名称:laravel-parsley,代码行数:8,代码来源:FormBuilder.php

示例6: color

 /**
  * Creates a color element
  *
  * @param string $name The name of the element
  * @param null   $value
  * @param array  $attributes
  * @return string
  */
 public function color($name, $value = null, $attributes = array())
 {
     $attributes['class'] = isset($attributes['class']) ? self::FORM_CONTROL . ' ' . $attributes['class'] : self::FORM_CONTROL;
     return parent::input('color', $name, $value, $attributes);
 }
开发者ID:olax,项目名称:epetitions,代码行数:13,代码来源:Form.php

示例7: input

 /**
  * Create a form input field.
  *
  * @param  string $type
  * @param  string $name
  * @param  string $value
  * @param  array  $options
  * @return string
  */
 public function input($type, $name, $value = null, $options = array())
 {
     $options = $this->addErrorClass($name, $options);
     $options = $this->checkRequired($name, $options);
     return parent::input($type, $name, $value, $options);
 }
开发者ID:artisaninweb,项目名称:laravel-formvalidation-helper,代码行数:15,代码来源:FormBuilder.php

示例8: inputField

 /**
  * @param Field $field
  * @return string
  */
 public function inputField(Field $field)
 {
     return $this->builder->input($field->type, $field->name, $field->value, $field->getAttributes());
 }
开发者ID:iyoworks,项目名称:form-builder,代码行数:8,代码来源:LaravelFormRenderer.php

示例9: checkable

 /**
  * Create a checkable input field.
  *
  * @param  string $type
  * @param  string $name
  * @param  mixed  $value
  * @param  bool   $checked
  * @param  array  $options
  *
  * @return string
  */
 protected function checkable($type, $name, $value, $checked, $options)
 {
     $checked = $this->getCheckedState($type, $name, $value, $checked);
     if ($checked) {
         $options['checked'] = 'checked';
     }
     return parent::input($type, $name, $value, $options);
 }
开发者ID:nterms,项目名称:laravel-bootstrap-forms,代码行数:19,代码来源:FormBuilder.php

示例10: input

 /**
  * Create a form input field.
  *
  * @param string                         $type
  * @param string                         $name
  * @param string                         $value
  * @param string                         $label
  * @param \Illuminate\Support\MessageBag $errors
  * @param array                          $options
  * @param array                          $parameters
  *
  * @return string
  */
 protected function input($type = 'text', $name, $label = null, $value = null, $errors = null, array $options = array(), array $parameters = array())
 {
     $return = '';
     $options = array_merge(array('class' => 'form-control', 'placeholder' => $label, 'id' => $name), $options);
     $containerAttributes = $this->getContainerAttributes($options);
     $labelAttributes = $this->getLabelAttributes($options);
     if (!isset($containerAttributes['display'])) {
         $return .= $this->group($name, $errors, 'form-group', $containerAttributes);
     }
     if ($type != 'search') {
         $return .= $this->label($name, $label, $labelAttributes);
     }
     if ($value === null) {
         $value = $this->input->get($name);
     }
     if ($this->formType == self::FORM_HORIZONTAL) {
         $return .= $this->group('', null, $this->inputClass);
     }
     switch ($type) {
         case 'datetime':
         case 'date':
         case 'time':
             if (isset($parameters['displayIcon']) && !$parameters['displayIcon']) {
                 unset($parameters['displayIcon']);
                 $return .= $this->form->text($name, $value, $options);
             } else {
                 $return .= '<div id="' . $name . '_' . $type . '" class="input-group ' . $type . '">';
                 $return .= $this->form->text($name, $value, $options);
                 $return .= '<span class="input-group-addon">' . "\n" . '<span class="glyphicon glyphicon-' . ($type == 'time' ? 'time' : 'calendar') . '"></span>' . "\n" . '</span>' . "\n" . '</div>' . "\n";
             }
             $return .= '<script type="text/javascript">$(function() { $("#' . $name . ', #' . $name . '_' . $type . '").datetimepicker({ ';
             switch ($type) {
                 case 'time':
                     $return .= 'pickDate: false, ';
                     break;
                 case 'date':
                     $return .= 'pickTime: false, ';
                     break;
                 case 'datetime':
                 default:
             }
             $return .= implode(', ', array_map(function ($value, $key) {
                 return $key . ': "' . $value . '"';
             }, $parameters, array_keys($parameters)));
             $return = rtrim($return, ', ');
             $return .= ' }); });</script>' . "\n";
             break;
         case 'password':
         case 'file':
             unset($options['placeholder']);
             $return .= $this->form->{$type}($name, $options) . "\n";
             break;
         case 'search':
             $return .= '<div class="input-group">' . "\n";
             $return .= $this->form->input('search', $name, $value, $options) . "\n";
             $return .= '<div class="input-group-btn">' . "\n";
             $return .= '<button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span></button>' . "\n";
             $return .= '</div>' . "\n";
             $return .= '</div>' . "\n";
             break;
         case 'telephone':
             $return .= $this->form->input('tel', $name, $value, $options) . "\n";
             break;
         case 'range':
             $return .= '<div class="input-group">' . "\n";
             $return .= '<div class="form-control">' . "\n";
             $return .= $this->form->input('range', $name, $value, array_merge($options, array('class' => '', 'onchange' => $name . 'value.value=value', 'oninput' => $name . 'value.value=value'))) . "\n";
             $return .= '</div>' . "\n";
             $return .= '<output id="' . $name . 'value" class="input-group-addon">0</output>' . "\n";
             $return .= '</div>' . "\n";
             break;
         case 'text':
         case 'hidden':
         case 'email':
         case 'textarea':
             $return .= $this->form->{$type}($name, $value, $options) . "\n";
             break;
         default:
             $return .= $this->form->input($type, $name, $value, $options) . "\n";
     }
     $return .= $this->errors($name, $errors);
     if ($this->formType == self::FORM_HORIZONTAL) {
         $return .= '</div>' . "\n";
     }
     if (!isset($containerAttributes['display'])) {
         $return .= '</div>' . "\n";
     }
//.........这里部分代码省略.........
开发者ID:jamalapriadi,项目名称:sia,代码行数:101,代码来源:BootstrapBase.php

示例11: input

 /**
  * Create a form input field.
  *
  * @param  string  $type
  * @param  string  $name
  * @param  string  $value
  * @param  array   $options
  * @return string
  */
 public function input($type, $name, $value = null, $options = array())
 {
     $this->appendReadOnly($options);
     return parent::input($type, $name, $value, $options);
 }
开发者ID:leitom,项目名称:role,代码行数:14,代码来源:FormBuilder.php

示例12: hidden

 /**
  * Create a hidden input field.
  *
  * @param  string $name
  * @param  string $value
  * @param  array $options
  * @return string
  */
 public function hidden($name, $value = null, $options = array())
 {
     return $this->form->input('hidden', $name, $value, $options);
 }
开发者ID:Junyue,项目名称:zidisha2,代码行数:12,代码来源:BootstrapFormBuilder.php

示例13: input

 /**
  * Create a form input field.
  *
  * @param  string  $type
  * @param  string  $name
  * @param  string  $value
  * @param  array   $options
  * @return \Illuminate\Support\HtmlString
  */
 public function input($type, $name, $value = null, $options = [])
 {
     return new HtmlString(parent::input($type, $name, $value, $options));
 }
开发者ID:minors,项目名称:html,代码行数:13,代码来源:FormBuilder.php

示例14: input

 /**
  * @see Illuminate\Html\FormBuilder
  */
 public function input($type, $name, $value = null, $options = [])
 {
     $options = $this->laravelToJquery($name) + $options;
     return parent::input($type, $name, $value, $options);
 }
开发者ID:bllim,项目名称:laravel-to-jquery-validation,代码行数:8,代码来源:FormBuilder.php

示例15: input

 /**
  * @see Illuminate\Html\FormBuilder
  */
 public function input($type, $name, $value = null, $options = [])
 {
     $options = $this->converter->convert(Helper::getFormAttribute($name)) + $options;
     return parent::input($type, $name, $value, $options);
 }
开发者ID:jitheshgopan,项目名称:laravalid,代码行数:8,代码来源:FormBuilder.php


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