public WidgetInterface::formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state)
Returns the form for a single field widget.
Field widget form elements should be based on the passed-in $element, which contains the base form element properties derived from the field configuration.
The BaseWidget methods will set the weight, field name and delta values for each form element. If there are multiple values for this field, the formElement()