You are here

public function Iso8601StringData::getConstraints in Duration Field 8.2

Same name and namespace in other branches
  1. 3.0.x src/Plugin/DataType/Iso8601StringData.php \Drupal\duration_field\Plugin\DataType\Iso8601StringData::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/DataType/Iso8601StringData.php, line 24

Class

Iso8601StringData
Provides the Iso8601String Typed Data object.

Namespace

Drupal\duration_field\Plugin\DataType

Code

public function getConstraints() {
  $constraint_manager = \Drupal::typedDataManager()
    ->getValidationConstraintManager();
  $constraints = parent::getConstraints();
  $constraints[] = $constraint_manager
    ->create('iso_8601_string', []);
  return $constraints;
}