From #2095195-79: Remove deprecated field_attach_form_*():

+++ b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php
@@ -148,6 +149,66 @@ public function getRenderer($field_name) {
+        $violations = $items->validate();

This would only create violations of constraints trigged by and assigned to the given field, but miss violations for this field but issues by cross-field validation of constraints put somewhere else. I think it would be better run validation on entity level and filter violations by field.
This seems to be more an edge case though, so I'd be fine with improving it in a follow-up.

Also, who is in charge of adding in violation errors on the root - the caller? If so, that needs to be documented.
Maybe validateFormValues() could return the list of violations that are not covered by the displayed fields, so the caller can move on with them?

Let's use this issue to fix handling of marking form validation violations across entity form and widgets.

Comments

berdir’s picture

fago’s picture

Assigned: fago » Unassigned
Status: Active » Closed (duplicate)

it is'nt - seems like we ended up with duplicates.