function NotNullConstraintValidator::validate
Same name in other branches
- 9 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/NotNullConstraintValidator.php \Drupal\Core\Validation\Plugin\Validation\Constraint\NotNullConstraintValidator::validate()
- 10 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/NotNullConstraintValidator.php \Drupal\Core\Validation\Plugin\Validation\Constraint\NotNullConstraintValidator::validate()
- 11.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/NotNullConstraintValidator.php \Drupal\Core\Validation\Plugin\Validation\Constraint\NotNullConstraintValidator::validate()
File
-
core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ NotNullConstraintValidator.php, line 23
Class
- NotNullConstraintValidator
- NotNull constraint validator.
Namespace
Drupal\Core\Validation\Plugin\Validation\ConstraintCode
public function validate($value, Constraint $constraint) {
$typed_data = $this->getTypedData();
if (($typed_data instanceof ListInterface || $typed_data instanceof ComplexDataInterface) && $typed_data->isEmpty()) {
$value = NULL;
}
parent::validate($value, $constraint);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.