diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php index e1da2b9052..0409ffc560 100644 --- a/core/lib/Drupal/Core/Field/WidgetBase.php +++ b/core/lib/Drupal/Core/Field/WidgetBase.php @@ -420,6 +420,9 @@ public function flagErrors(FieldItemListInterface $items, ConstraintViolationLis $field_name = $this->fieldDefinition->getName(); $field_state = static::getWidgetState($form['#parents'], $field_name, $form_state); + if (empty($field_state)) { + return; + } if ($violations->count()) { // Locate the correct element in the form.