class RangeConstraint

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/RangeConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\RangeConstraint
  2. 10 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.

Plugin annotation


@Constraint(
  id = "Range",
  label = @Translation("Range", context = "Validation"),
  type = { "integer", "float" }
)

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 20

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint
View source
class RangeConstraint extends Range {
    public $minMessage = 'This value should be %limit or more.';
    public $maxMessage = 'This value should be %limit or less.';

}

Members

Title Sort descending Modifiers Object type Summary
RangeConstraint::$maxMessage public property
RangeConstraint::$minMessage public property

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