You are here

public function DimensionsItem::getConstraints in Physical Fields 8

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/DimensionsItem.php, line 87

Class

DimensionsItem
Plugin implementation of the 'physical_dimensions' field type.

Namespace

Drupal\physical\Plugin\Field\FieldType

Code

public function getConstraints() {
  $constraint_manager = $this
    ->getTypedDataManager()
    ->getValidationConstraintManager();
  $constraints = parent::getConstraints();
  $constraints[] = $constraint_manager
    ->create('Dimensions', []);
  return $constraints;
}