function StringTextareaWidget::settingsForm

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

Overrides WidgetBase::settingsForm

1 method overrides StringTextareaWidget::settingsForm()
TextareaWidget::settingsForm in core/modules/text/src/Plugin/Field/FieldWidget/TextareaWidget.php
Returns a form to configure settings for the widget.

File

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

Class

StringTextareaWidget
Plugin implementation of the 'string_textarea' widget.

Namespace

Drupal\Core\Field\Plugin\Field\FieldWidget

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
    $element['rows'] = [
        '#type' => 'number',
        '#title' => $this->t('Rows'),
        '#default_value' => $this->getSetting('rows'),
        '#required' => TRUE,
        '#min' => 1,
    ];
    $element['placeholder'] = [
        '#type' => 'textarea',
        '#title' => $this->t('Placeholder'),
        '#default_value' => $this->getSetting('placeholder'),
        '#description' => $this->t('Text that will be shown inside the field until a value is entered. This hint is usually a sample value or a brief description of the expected format.'),
    ];
    return $element;
}

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