Collective\Html\FormBuilder::input PHP Метод

input() публичный Метод

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
Результат Illuminate\Support\HtmlString
    public function input($type, $name, $value = null, $options = [])
    {
        if (!isset($options['name'])) {
            $options['name'] = $name;
        }
        // We will get the appropriate value for the given field. We will look for the
        // value in the session for the value in the old input data then we'll look
        // in the model instance if one is set. Otherwise we will just use empty.
        $id = $this->getIdAttribute($name, $options);
        if (!in_array($type, $this->skipValueTypes)) {
            $value = $this->getValueAttribute($name, $value);
        }
        // Once we have the type, value, and ID we can merge them into the rest of the
        // attributes array so we can convert them into their HTML attribute format
        // when creating the HTML element. Then, we will return the entire input.
        $merge = compact('type', 'value', 'id');
        $options = array_merge($options, $merge);
        return $this->toHtmlString('<input' . $this->html->attributes($options) . '>');
    }

Usage Example

 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, []));
 }
All Usage Examples Of Collective\Html\FormBuilder::input