public function PriceModifiedItem::getConstraints in Price 3.0.x
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldType/PriceModifiedItem.php \Drupal\price\Plugin\Field\FieldType\PriceModifiedItem::getConstraints()
- 3.x src/Plugin/Field/FieldType/PriceModifiedItem.php \Drupal\price\Plugin\Field\FieldType\PriceModifiedItem::getConstraints()
Gets a list of validation constraints.
Return value
array Array of constraints, each being an instance of \Symfony\Component\Validator\Constraint.
Overrides PriceItem::getConstraints
File
- src/
Plugin/ Field/ FieldType/ PriceModifiedItem.php, line 92
Class
- PriceModifiedItem
- Plugin implementation of the 'modified price' field type.
Namespace
Drupal\price\Plugin\Field\FieldTypeCode
public function getConstraints() {
$manager = \Drupal::typedDataManager()
->getValidationConstraintManager();
$constraints = parent::getConstraints();
$available_modifiers = $this
->getSetting('available_modifiers');
$constraints[] = $manager
->create('PriceModifier', [
'availableModifiers' => $available_modifiers,
]);
return $constraints;
}