// Collect widget elements.
$elements =
[];
// If the widget is handling multiple values (e.g Options), or if we are
// displaying an individual element, just get a single form element and make
// it the $delta value.
if ($this->
handlesMultipleValues() ||
isset($get_delta)) { $delta =
$get_delta ?? 0;
$element =
[ '#title' =>
$this->fieldDefinition->
getLabel(),
'#description' =>
$this->
getFilteredDescription(),
];
$element =
$this->
formSingleElement($items,
$delta,
$element,
$form,
$form_state);
if ($element) { if (isset($get_delta)) { // If we are processing a specific delta value for a field where the
// field module handles multiples, set the delta in the result.
$elements[$delta] =
$element;
} else { // For fields that handle their own processing, we cannot make