function EmailDefaultWidget::formElement
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EmailDefaultWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\EmailDefaultWidget::formElement()
- 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EmailDefaultWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\EmailDefaultWidget::formElement()
- 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EmailDefaultWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\EmailDefaultWidget::formElement()
Overrides WidgetInterface::formElement
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldWidget/ EmailDefaultWidget.php, line 74
Class
- EmailDefaultWidget
- Plugin implementation of the 'email_default' 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' => 'email',
'#default_value' => $items[$delta]->value ?? NULL,
'#placeholder' => $this->getSetting('placeholder'),
'#size' => $this->getSetting('size'),
'#maxlength' => Email::EMAIL_MAX_LENGTH,
];
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.