Collective\Html\FormBuilder::textarea PHP Method

textarea() public method

Create a textarea input field.
public textarea ( string $name, string $value = null, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$value string
$options array
return Illuminate\Support\HtmlString
    public function textarea($name, $value = null, $options = [])
    {
        if (!isset($options['name'])) {
            $options['name'] = $name;
        }
        // Next we will look for the rows and cols attributes, as each of these are put
        // on the textarea element definition. If they are not present, we will just
        // assume some sane default values for these attributes for the developer.
        $options = $this->setTextAreaSize($options);
        $options['id'] = $this->getIdAttribute($name, $options);
        $value = (string) $this->getValueAttribute($name, $value);
        unset($options['size']);
        // Next we will convert the attributes into a string form. Also we have removed
        // the size attribute, as it was merely a short-cut for the rows and cols on
        // the element. Then we'll create the final textarea elements HTML for us.
        $options = $this->html->attributes($options);
        return $this->toHtmlString('<textarea' . $options . '>' . e($value) . '</textarea>');
    }

Usage Example

 public function textarea($name, $value = null, $options = [])
 {
     return sprintf('
     <div class="input-field col l6 s8 offset-l3 offset-s2">
         %s
         %s
     </div>', parent::textarea($name, $value, ['class' => 'materialize-textarea']), parent::label($name, null, []));
 }
All Usage Examples Of Collective\Html\FormBuilder::textarea