input() public method

Create a form input field.
public input ( string $type, string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$type string
$name string
$value string
$options array
return Illuminate\Support\HtmlString
 private function commonInputs($type, $name, $value = null, $options = [])
 {
     return sprintf('
     <div class="input-field col l6 s8 offset-l3 offset-s2">
         %s
         %s
     </div>', parent::input($type, $name, $value, $options), parent::label($name, null, []));
 }
Esempio n. 2
0
 /**
  * Create a Boostrap file upload button.
  *
  * @param  string  $name
  * @param  string  $label
  * @param  array   $options
  * @return string
  */
 public function file($name, $label = null, array $options = [], $extra = null)
 {
     $label = $this->getLabelTitle($label, $name);
     $options = array_merge(['class' => 'filestyle', 'data-buttonBefore' => 'true'], $options);
     $options = $this->getFieldOptions($options, $name);
     $inputElement = $this->form->input('file', $name, null, $options);
     $wrapperOptions = $this->isHorizontal() ? ['class' => $this->getRightColumnClass()] : [];
     $wrapperElement = '<div' . $this->html->attributes($wrapperOptions) . '>' . $inputElement . $this->getFieldError($name) . '</div>';
     return $this->getFormGroupWithLabel($name, $label, $wrapperElement, $extra);
 }
Esempio n. 3
0
 /**
  * Create a Boostrap file upload button.
  *
  * @param  string  $name
  * @param  string  $label
  * @param  array   $options
  * @return string
  */
 public function file($name, $label = null, array $options = [])
 {
     $label = $this->getLabelTitle($label, $name);
     $options = array_merge(['class' => 'filestyle', 'data-buttonBefore' => 'true'], $options);
     $options = $this->getFieldOptions($options);
     $wrapperOptions = [];
     if ($this->getType() === Type::HORIZONTAL) {
         $wrapperOptions = ['class' => $this->getRightColumnClass()];
     }
     $inputElement = $this->form->input('file', $name, null, $options);
     $groupElement = '<div ' . $this->html->attributes($wrapperOptions) . '>' . $inputElement . $this->getFieldError($name) . '</div>';
     return $this->getFormGroupWithLabel($name, $label, $groupElement);
 }
Esempio n. 4
0
 /**
  * Build all control with the css class, label, and input.
  *
  * @param       $type
  * @param       $name
  * @param null  $value
  * @param array $attributes
  * @param array $options
  * @return string
  */
 public function buildControl($type, $name, $value = null, $attributes = [], $options = [])
 {
     switch ($type) {
         case 'select':
             $options = ['' => config('field-builder.select')] + $options;
             return $this->form->select($name, $options, $value, $attributes);
         case 'password':
             return $this->form->password($name, $attributes);
         case 'checkbox':
             return $this->form->checkbox($name, $value, isset($attributes['checked']), $attributes);
         case 'textarea':
             return $this->form->textarea($name, $value, $attributes);
         case 'number':
             return $this->form->number($name, $value, $attributes);
         case 'radio':
             return $this->form->radio($name, $value, $attributes);
         case 'email':
             return $this->form->email($name, $value, $attributes);
         default:
             return $this->form->input($type, $name, $value, $attributes);
     }
 }
 /**
  * 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 \Collective\Html\FormBuilder::input($type, $name, $value, $options);
 }
 /**
  * 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);
 }
 /**
  * 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 = [])
 {
     return parent::input($type, $name, $value, $this->appendErrors($name, $options));
 }
Esempio n. 8
0
 /**
  * @see Collective\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);
 }
Esempio n. 9
0
 public function inputSet($type, $name, $value = null, $options = [], $customInput = null)
 {
     $options = $this->converter->convert(Helper::getFormAttribute($name)) + $options;
     $labelText = isset($options['label']) ? $options['label'] : null;
     $requiredLabel = isset($options['data-rule-required']) ? self::$requiredLabel : '';
     $label = self::label($name, $labelText, [], $requiredLabel);
     $input = isset($customInput) ? $customInput : parent::input($type, $name, $value, $options);
     return self::makeSet($label, $input);
 }
Esempio n. 10
0
 /**
  * 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);
 }