You are here

public function TaxRateItemList::getConstraints in Commerce Product Tax 8

Gets a list of validation constraints.

Return value

array Array of constraints, each being an instance of \Symfony\Component\Validator\Constraint.

Overrides FieldItemList::getConstraints

File

src/Plugin/Field/FieldType/TaxRateItemList.php, line 15

Class

TaxRateItemList
Represents a list of tax rate item field values.

Namespace

Drupal\commerce_product_tax\Plugin\Field\FieldType

Code

public function getConstraints() {
  $constraints = parent::getConstraints();
  $constraints[] = $this
    ->getTypedDataManager()
    ->getValidationConstraintManager()
    ->create('TaxRate', [
    'singleTaxRatePerZoneMessage' => t('%name: cannot select more than one tax rate per zone.', [
      '%name' => $this
        ->getFieldDefinition()
        ->getLabel(),
    ]),
  ]);
  return $constraints;
}