class LengthConstraint in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/LengthConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\LengthConstraint
- 9 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/LengthConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\LengthConstraint
Length constraint.
Overrides the symfony constraint to use Drupal-style replacement patterns.
@todo: Move this below the TypedData core component.
Plugin annotation
@Constraint(
id = "Length",
label = @Translation("Length", context = "Validation"),
type = { "string" }
)
Hierarchy
- class \Drupal\Core\Validation\Plugin\Validation\Constraint\LengthConstraint extends \Symfony\Component\Validator\Constraints\Length
Expanded class hierarchy of LengthConstraint
File
- core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ LengthConstraint.php, line 20
Namespace
Drupal\Core\Validation\Plugin\Validation\ConstraintView source
class LengthConstraint extends Length {
public $maxMessage = 'This value is too long. It should have %limit character or less.|This value is too long. It should have %limit characters or less.';
public $minMessage = 'This value is too short. It should have %limit character or more.|This value is too short. It should have %limit characters or more.';
public $exactMessage = 'This value should have exactly %limit character.|This value should have exactly %limit characters.';
/**
* {@inheritdoc}
*/
public function validatedBy() {
return '\\Symfony\\Component\\Validator\\Constraints\\LengthValidator';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LengthConstraint:: |
public | property | ||
LengthConstraint:: |
public | property | ||
LengthConstraint:: |
public | property | ||
LengthConstraint:: |
public | function |