Problem/Motivation
It is common that form validators are validating the form values using form state. However, in some unique cases like \Drupal\Core\Field\FieldItemList::defaultValuesFormValidate
, the validation depends on the actual entity that is attached to the form. In these cases, it is important that the entity is up-to-date, and that any normalizing done prior have been extracted to the entity, because otherwise the validation is not validating what it's supposed to validate.
In #3345149: Extra Default value field when adding a field with an unlimited values, we needed to add a manual call to \Drupal\Core\Entity\EntityForm::buildEntity
to ensure that the entity has been updated which isn't ideal for DX.