function StringTextareaWidget::formElement

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\StringTextareaWidget::formElement()
  2. 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\StringTextareaWidget::formElement()
  3. 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\StringTextareaWidget::formElement()

Overrides WidgetInterface::formElement

1 call to StringTextareaWidget::formElement()
TextareaWidget::formElement in core/modules/text/src/Plugin/Field/FieldWidget/TextareaWidget.php
Returns the form for a single field widget.
1 method overrides StringTextareaWidget::formElement()
TextareaWidget::formElement in core/modules/text/src/Plugin/Field/FieldWidget/TextareaWidget.php
Returns the form for a single field widget.

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php, line 69

Class

StringTextareaWidget
Plugin implementation of the 'string_textarea' widget.

Namespace

Drupal\Core\Field\Plugin\Field\FieldWidget

Code

public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
    $element['value'] = $element + [
        '#type' => 'textarea',
        '#default_value' => $items[$delta]->value,
        '#rows' => $this->getSetting('rows'),
        '#placeholder' => $this->getSetting('placeholder'),
        '#attributes' => [
            'class' => [
                'js-text-full',
                'text-full',
            ],
        ],
    ];
    return $element;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.