if (!
$this->
handlesMultipleValues()) { // Remove the 'value' of the 'add more' button.
unset($values['add_more'
]);
// The original delta, before drag-and-drop reordering, is needed to
// route errors to the correct form element.
foreach ($values as $delta => &
$value) { $value['_original_delta'
] =
$delta;
} usort($values,
function D
$a,
$b) { return SortArray::
sortByKeyInt($a,
$b, '_weight'
);
});
} // Let the widget massage the submitted values.
$values =
$this->
massageFormValues($values,
$form,
$form_state);
// Assign the values and remove the empty ones.
$items->
setValue($values);
$items->
filterEmptyItems();
// Put delta mapping in $form_state, so that flagErrors() can use it.