function StringTextfieldWidget::formElement
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextfieldWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\StringTextfieldWidget::formElement()
- 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextfieldWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\StringTextfieldWidget::formElement()
- 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextfieldWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\StringTextfieldWidget::formElement()
Overrides WidgetInterface::formElement
2 calls to StringTextfieldWidget::formElement()
- OEmbedWidget::formElement in core/
modules/ media/ src/ Plugin/ Field/ FieldWidget/ OEmbedWidget.php - Returns the form for a single field widget.
- TextfieldWidget::formElement in core/
modules/ text/ src/ Plugin/ Field/ FieldWidget/ TextfieldWidget.php - Returns the form for a single field widget.
2 methods override StringTextfieldWidget::formElement()
- OEmbedWidget::formElement in core/
modules/ media/ src/ Plugin/ Field/ FieldWidget/ OEmbedWidget.php - Returns the form for a single field widget.
- TextfieldWidget::formElement in core/
modules/ text/ src/ Plugin/ Field/ FieldWidget/ TextfieldWidget.php - Returns the form for a single field widget.
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldWidget/ StringTextfieldWidget.php, line 69
Class
- StringTextfieldWidget
- Plugin implementation of the 'string_textfield' widget.
Namespace
Drupal\Core\Field\Plugin\Field\FieldWidgetCode
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element['value'] = $element + [
'#type' => 'textfield',
'#default_value' => $items[$delta]->value ?? NULL,
'#size' => $this->getSetting('size'),
'#placeholder' => $this->getSetting('placeholder'),
'#maxlength' => $this->getFieldSetting('max_length'),
'#attributes' => [
'class' => [
'js-text-full',
'text-full',
],
],
];
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.