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