function TelephoneDefaultWidget::formElement
Same name in other branches
- 9 core/modules/telephone/src/Plugin/Field/FieldWidget/TelephoneDefaultWidget.php \Drupal\telephone\Plugin\Field\FieldWidget\TelephoneDefaultWidget::formElement()
- 10 core/modules/telephone/src/Plugin/Field/FieldWidget/TelephoneDefaultWidget.php \Drupal\telephone\Plugin\Field\FieldWidget\TelephoneDefaultWidget::formElement()
- 11.x core/modules/telephone/src/Plugin/Field/FieldWidget/TelephoneDefaultWidget.php \Drupal\telephone\Plugin\Field\FieldWidget\TelephoneDefaultWidget::formElement()
Overrides WidgetInterface::formElement
File
-
core/
modules/ telephone/ src/ Plugin/ Field/ FieldWidget/ TelephoneDefaultWidget.php, line 64
Class
- TelephoneDefaultWidget
- Plugin implementation of the 'telephone_default' widget.
Namespace
Drupal\telephone\Plugin\Field\FieldWidgetCode
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element['value'] = $element + [
'#type' => 'tel',
'#default_value' => isset($items[$delta]->value) ? $items[$delta]->value : NULL,
'#placeholder' => $this->getSetting('placeholder'),
];
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.