diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php index ec109cf..c8ff90e 100644 --- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php @@ -25,7 +25,7 @@ public function validate($value, Constraint $constraint) { if ($typed_data instanceof AllowedValuesInterface) { $account = \Drupal::currentUser(); - $allowed_values = $this->context->getMetadata()->getTypedData()->getSettableValues($account); + $allowed_values = $typed_data->getSettableValues($account); $constraint->choices = $allowed_values; // If the data is complex, we have to validate its main property. @@ -35,10 +35,6 @@ public function validate($value, Constraint $constraint) { throw new \LogicException('Cannot validate allowed values for complex data without a main property.'); } $value = $typed_data->get($name)->getValue(); - // If main property's value is NULL, we make the validation pass. - if (empty($value)) { - return TRUE; - } } } return parent::validate($value, $constraint);