function TextWidget::formElement
Same name in this branch
- 3.x modules/field_example/src/Plugin/Field/FieldWidget/TextWidget.php \Drupal\field_example\Plugin\Field\FieldWidget\TextWidget::formElement()
Same name in other branches
- 4.0.x modules/field_permission_example/src/Plugin/Field/FieldWidget/TextWidget.php \Drupal\field_permission_example\Plugin\Field\FieldWidget\TextWidget::formElement()
- 4.0.x modules/field_example/src/Plugin/Field/FieldWidget/TextWidget.php \Drupal\field_example\Plugin\Field\FieldWidget\TextWidget::formElement()
Overrides WidgetInterface::formElement
File
-
modules/
field_permission_example/ src/ Plugin/ Field/ FieldWidget/ TextWidget.php, line 26
Class
- TextWidget
- Plugin implementation of the 'field_permission_example_widget' widget.
Namespace
Drupal\field_permission_example\Plugin\Field\FieldWidgetCode
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$value = $items[$delta]->value ?? '';
$element += [
'#type' => 'textarea',
'#default_value' => $value,
];
return [
'value' => $element,
];
}