You are here

public function RangeConstraint::__construct in Drupal 10

File

core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/RangeConstraint.php, line 25

Class

RangeConstraint
Range constraint.

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint

Code

public function __construct(array $options = NULL) {
  if (isset($options['min']) && isset($options['max'])) {
    $options['notInRangeMessage'] = $options['notInRangeMessage'] ?? 'This value should be between %min and %max.';
  }
  else {
    $options['minMessage'] = $options['minMessage'] ?? 'This value should be %limit or more.';
    $options['maxMessage'] = $options['maxMessage'] ?? 'This value should be %limit or less.';
  }
  parent::__construct($options);
}