public function TextareaWithSummaryWidget::settingsForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/text/src/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php \Drupal\text\Plugin\Field\FieldWidget\TextareaWithSummaryWidget::settingsForm()
- 9 core/modules/text/src/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php \Drupal\text\Plugin\Field\FieldWidget\TextareaWithSummaryWidget::settingsForm()
Returns a form to configure settings for the widget.
Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the widget. The field_ui module takes care of handling submitted form values.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form definition for the widget settings.
Overrides TextareaWidget::settingsForm
File
- core/
modules/ text/ src/ Plugin/ Field/ FieldWidget/ TextareaWithSummaryWidget.php, line 37
Class
- TextareaWithSummaryWidget
- Plugin implementation of the 'text_textarea_with_summary' widget.
Namespace
Drupal\text\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$element = parent::settingsForm($form, $form_state);
$element['summary_rows'] = [
'#type' => 'number',
'#title' => t('Summary rows'),
'#default_value' => $this
->getSetting('summary_rows'),
'#description' => $element['rows']['#description'],
'#required' => TRUE,
'#min' => 1,
];
$element['show_summary'] = [
'#type' => 'checkbox',
'#title' => t('Always show the summary field'),
'#default_value' => $this
->getSetting('show_summary'),
];
return $element;
}