class RangeConstraint

Same name in other branches
  1. 9 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/RangeConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\RangeConstraint
  2. 8.9.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/RangeConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\RangeConstraint
  3. 11.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/RangeConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\RangeConstraint

Range constraint.

Overrides the symfony constraint to use Drupal-style replacement patterns.

@todo Move this below the TypedData core component.

Hierarchy

  • class \Drupal\Core\Validation\Plugin\Validation\Constraint\RangeConstraint extends \Symfony\Component\Validator\Constraints\Range

Expanded class hierarchy of RangeConstraint

File

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

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint
View source
class RangeConstraint extends Range {
    
    /**
     * {@inheritdoc}
     */
    public function __construct(...$args) {
        $this->notInRangeMessage = 'This value should be between %min and %max.';
        $this->minMessage = 'This value should be %limit or more.';
        $this->maxMessage = 'This value should be %limit or less.';
        parent::__construct(...$args);
    }

}

Members

Title Sort descending Modifiers Object type Summary
RangeConstraint::__construct public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.