function TextareaWidget::formElement
Same name in other branches
- 8.9.x core/modules/text/src/Plugin/Field/FieldWidget/TextareaWidget.php \Drupal\text\Plugin\Field\FieldWidget\TextareaWidget::formElement()
- 10 core/modules/text/src/Plugin/Field/FieldWidget/TextareaWidget.php \Drupal\text\Plugin\Field\FieldWidget\TextareaWidget::formElement()
- 11.x core/modules/text/src/Plugin/Field/FieldWidget/TextareaWidget.php \Drupal\text\Plugin\Field\FieldWidget\TextareaWidget::formElement()
Overrides StringTextareaWidget::formElement
1 call to TextareaWidget::formElement()
- TextareaWithSummaryWidget::formElement in core/
modules/ text/ src/ Plugin/ Field/ FieldWidget/ TextareaWithSummaryWidget.php - Returns the form for a single field widget.
1 method overrides TextareaWidget::formElement()
- TextareaWithSummaryWidget::formElement in core/
modules/ text/ src/ Plugin/ Field/ FieldWidget/ TextareaWithSummaryWidget.php - Returns the form for a single field widget.
File
-
core/
modules/ text/ src/ Plugin/ Field/ FieldWidget/ TextareaWidget.php, line 35
Class
- TextareaWidget
- Plugin implementation of the 'text_textarea' widget.
Namespace
Drupal\text\Plugin\Field\FieldWidgetCode
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$main_widget = parent::formElement($items, $delta, $element, $form, $form_state);
$element = $main_widget['value'];
$element['#type'] = 'text_format';
$element['#format'] = $items[$delta]->format;
$element['#base_type'] = $main_widget['value']['#type'];
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.