public function TimeType::getConstraints in Time Field For Drupal 8.x / 9.x 8
Same name and namespace in other branches
- 2.x src/Plugin/Field/FieldType/TimeType.php \Drupal\time_field\Plugin\Field\FieldType\TimeType::getConstraints()
Gets a list of validation constraints.
Return value
array Array of constraints, each being an instance of \Symfony\Component\Validator\Constraint.
Overrides TypedData::getConstraints
File
- src/
Plugin/ Field/ FieldType/ TimeType.php, line 61
Class
- TimeType
- Plugin implementation of the 'time' field type.
Namespace
Drupal\time_field\Plugin\Field\FieldTypeCode
public function getConstraints() {
$constraints = parent::getConstraints();
$constraint_manager = \Drupal::typedDataManager()
->getValidationConstraintManager();
$constraints[] = $constraint_manager
->create('ComplexData', [
'value' => [
'time' => [],
],
]);
return $constraints;
}