TaxRateItemList.php in Commerce Product Tax 8
File
src/Plugin/Field/FieldType/TaxRateItemList.php
View source
<?php
namespace Drupal\commerce_product_tax\Plugin\Field\FieldType;
use Drupal\Core\Field\FieldItemList;
class TaxRateItemList extends FieldItemList {
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;
}
}