function TextareaWithSummaryWidget::settingsForm

Same name in other branches
  1. 9 core/modules/text/src/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php \Drupal\text\Plugin\Field\FieldWidget\TextareaWithSummaryWidget::settingsForm()
  2. 8.9.x core/modules/text/src/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php \Drupal\text\Plugin\Field\FieldWidget\TextareaWithSummaryWidget::settingsForm()
  3. 11.x core/modules/text/src/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php \Drupal\text\Plugin\Field\FieldWidget\TextareaWithSummaryWidget::settingsForm()

Overrides TextareaWidget::settingsForm

File

core/modules/text/src/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php, line 36

Class

TextareaWithSummaryWidget
Plugin implementation of the 'text_textarea_with_summary' widget.

Namespace

Drupal\text\Plugin\Field\FieldWidget

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
    $element = parent::settingsForm($form, $form_state);
    $element['summary_rows'] = [
        '#type' => 'number',
        '#title' => $this->t('Summary rows'),
        '#default_value' => $this->getSetting('summary_rows'),
        '#description' => $element['rows']['#description'],
        '#required' => TRUE,
        '#min' => 1,
    ];
    $element['show_summary'] = [
        '#type' => 'checkbox',
        '#title' => $this->t('Always show the summary field'),
        '#default_value' => $this->getSetting('show_summary'),
    ];
    return $element;
}

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