text() public method

Create a text input field.
public text ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
return Illuminate\Support\HtmlString
 public function textfield($name, $label, $errors, $labelOptions = array(), $inputOptions = array())
 {
     $labelOptions['class'] = 'form-label';
     $inputOptions['class'] = 'form-control';
     $inputOptions['placeholder'] = $label;
     return sprintf('<div class="form-group">%s<div%s>%s%s</div></div><!-- end form-group -->', parent::label($name, $label, $labelOptions), $errors->has($name) ? ' class="error-control"' : '', parent::text($name, null, $inputOptions), $errors->has($name) ? '<span class="error"><label class="error" for="' . $name . '">' . $errors->first($name) . '</label></span>' : '');
 }
Exemplo n.º 2
0
 /**
  * Create a submit button with default classes
  *
  * @param null $value
  * @param array $options
  * @return string
  */
 public function getFormGroupText($label, $id, $value, $errors)
 {
     $feedBackSelector = $this->getFeedBackSelector($errors, $id);
     $feedBackHtml = $this->getFeedBackHtml($errors, $id);
     $retval = "<div class=\"form-group  " . $feedBackSelector . "\">\n                " . parent::label('' . $id . '', '' . $label . ':', ['class' => 'control-label']) . "\n                " . parent::text('' . $id . '', $value, ['class' => 'form-control']) . "\n                " . $feedBackHtml . "\n            </div>";
     return $retval;
 }
 public function text($name, $value = null, $options = [])
 {
     return sprintf('
     <div class="input-field col l6 s8 offset-l3 offset-s2">
         %s
         %s
     </div>', parent::text($name, $value, $options), parent::label($name, null, []));
 }
 private function registerFormTextField()
 {
     FormBuilder::macro('textField', function ($type, $name, $errors, $label, $labelOptions = array(), $inputOptions = array(), $inputClass) {
         $valeur = \Request::old($name) ? \Request::old($name) : null;
         $inputOptions['class'] = 'form-control';
         return sprintf('
             <div class="form-group">
                 %s
                 <div class="' . $inputClass . '">
                     %s
                 </div>
             </div>', FormBuilder::label($name, $label, $labelOptions), $type == 'email' ? FormBuilder::email($name, $valeur, $inputOptions) : FormBuilder::text($name, $valeur, $inputOptions), $errors->first($name, '<small class="help-block">:message</small>'));
     });
 }
Exemplo n.º 5
0
 /**
  * Create a text input field.
  *
  * @param string $name
  * @param string $value
  * @param array $options
  * @return string 
  * @static 
  */
 public static function text($name, $value = null, $options = array())
 {
     return \Collective\Html\FormBuilder::text($name, $value, $options);
 }
 /**
  * @param $name
  * @param $labelText
  * @param null $value
  * @param array $options
  * @return string
  */
 public function wrappedText($name, $labelText, $value = null, $options = [])
 {
     return $this->wrapWithLabel($name, $labelText, $options, parent::text($name, $value, $this->appendErrors($name, $options)));
 }
Exemplo n.º 7
0
 public function postalcode($name, $value = null, $options = [])
 {
     if (isset($options['class'])) {
         $options['class'] .= ' postalcodeNL';
     } else {
         $options['class'] = 'postalcodeNL';
     }
     $options = $this->converter->convert(Helper::getFormAttribute($name)) + $options;
     return parent::text($name, $value, $options);
 }
Exemplo n.º 8
0
 public function text($name, $value = null, $options = [])
 {
     $options = $this->setOptionClasses($name, $options, ['form-control']);
     $controlOptions = array_filter($options, function ($key) {
         return $key !== 'label';
     }, ARRAY_FILTER_USE_KEY);
     $controlHtml = parent::text($name, $value, $controlOptions);
     return $this->renderControl('text', $controlHtml, $name, $value, $options);
 }
Exemplo n.º 9
0
 /**
  * {@inheritdoc}
  * @param string      $name       The name of the text input
  * @param string|null $value      The default value
  * @param array       $attributes The attributes of the input
  * @return string
  */
 public function text($name, $value = null, $attributes = array())
 {
     $attributes['class'] = isset($attributes['class']) ? self::FORM_CONTROL . ' ' . $attributes['class'] : self::FORM_CONTROL;
     return parent::text($name, $value, $attributes);
 }
Exemplo n.º 10
0
 /**
  * Create a text input field.
  *
  * @param  string  $name
  * @param  string  $value
  * @param  array   $options
  *
  * @return string
  */
 public function text($name, $value = null, $options = [])
 {
     $this->addErrorClass($name, $options);
     $tags['input'] = parent::text($name, $value, $options);
     $tags['error'] = $this->getErrorTag($name);
     return $this->buildTags($tags);
 }
Exemplo n.º 11
0
    $addon .= '<span class="fa fa-' . $content . '"></span>';
    $addon .= "</span>";
    $element = Form::text($name, $value ? $value : old($name), field_attributes($name, $attributes));
    $out = '<div class="input-group">';
    $out .= $end ? '' : $addon;
    $out .= $element;
    $out .= $end ? $addon : '';
    $out .= '</div>';
    return field_wrapper($name, $label, $out);
});
Form::macro('textFieldIconClean', function ($name, $label = NULL, $content = 'pencil', $end = false, array $attributes = [], $value = NULL) {
    $addon = '<span class="input-group-addon">';
    $addon .= '<span class="fa fa-' . $content . '"></span>';
    $addon .= "</span>";
    $attributes = array_merge($attributes, ['placeholder' => $label]);
    $element = Form::text($name, $value ? $value : old($name), field_attributes($name, $attributes));
    $out = '<div class="input-group">';
    $out .= $end ? '' : $addon;
    $out .= $element;
    $out .= $end ? $addon : '';
    $out .= '</div>';
    return field_wrapper($name, $out, '');
});
Form::macro('emailFieldIcon', function ($name, $label, $content = 'envelope', $end = false, array $attributes = [], $value = NULL) {
    $addon = '<span class="input-group-addon">';
    $addon .= '<span class="fa fa-' . $content . '"></span>';
    $addon .= "</span>";
    $element = Form::email($name, $value ? $value : old($name), field_attributes($name, $attributes));
    $out = '<div class="input-group">';
    $out .= $end ? '' : $addon;
    $out .= $element;