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. 10 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
1 method overrides StringTextareaWidget::formElement()
TextareaWidget::formElement in core/modules/text/src/Plugin/Field/FieldWidget/TextareaWidget.php

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.