- Issue created by @lauriii
I found a regression caused by the Field UI changes in the Geocoder module:
🐛
TypeError on Drupal 10.2.0
Fixed
. As I debugged that, I realized that the problem was caused by the fact that Geocoder added its validator after the ::validateForm
, meaning that the form state changes it makes are not taken into account when rebuilding the entity for the form rebuild. We didn't notice this earlier because on form submit, the entity is built with the correct form state. This is possible thanks to the fact that the entity is rebuilt again in \Drupal\Core\Entity\EntityForm::submitForm
.
Looking at \Drupal\Core\Form\FormBuilder::processForm
, it looks like the Form API doesn't have any API that would allow intersecting between the form rebuild and validation. In the case of the Geocoder module, the solution seems as simple as running the validator before ::validateForm
. This doesn't remove the fact that this is highly confusing and brittle.
Active
11.0 🔥