public function BigIntItem::getConstraints in Big Integer 8
Gets a list of validation constraints.
Return value
array Array of constraints, each being an instance of \Symfony\Component\Validator\Constraint.
Overrides NumericItemBase::getConstraints
File
- src/
Plugin/ Field/ FieldType/ BigIntItem.php, line 50
Class
- BigIntItem
- Defines the 'bigint' field type.
Namespace
Drupal\bigint\Plugin\Field\FieldTypeCode
public function getConstraints() {
$constraints = parent::getConstraints();
if ($this
->getSetting('unsigned')) {
$constraint_manager = \Drupal::typedDataManager()
->getValidationConstraintManager();
$constraints[] = $constraint_manager
->create('ComplexData', [
'value' => [
'Range' => [
'min' => 0,
'minMessage' => t('%name: The integer must be larger or equal to %min.', [
'%name' => $this
->getFieldDefinition()
->getLabel(),
'%min' => 0,
]),
],
],
]);
}
return $constraints;
}