public function TypedData::getConstraints in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/TypedData/TypedData.php \Drupal\Core\TypedData\TypedData::getConstraints()
Gets a list of validation constraints.
Return value
array Array of constraints, each being an instance of \Symfony\Component\Validator\Constraint.
Overrides TypedDataInterface::getConstraints
9 calls to TypedData::getConstraints()
- EmailItem::getConstraints in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ EmailItem.php - Gets a list of validation constraints.
- EntityReferenceItem::getConstraints in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ EntityReferenceItem.php - Gets a list of validation constraints.
- FieldItemList::getConstraints in core/
lib/ Drupal/ Core/ Field/ FieldItemList.php - Gets a list of validation constraints.
- NumericItemBase::getConstraints in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ NumericItemBase.php - Gets a list of validation constraints.
- StringItem::getConstraints in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ StringItem.php - Gets a list of validation constraints.
9 methods override TypedData::getConstraints()
- EmailItem::getConstraints in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ EmailItem.php - Gets a list of validation constraints.
- EntityReferenceItem::getConstraints in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ EntityReferenceItem.php - Gets a list of validation constraints.
- FieldItemList::getConstraints in core/
lib/ Drupal/ Core/ Field/ FieldItemList.php - Gets a list of validation constraints.
- NumericItemBase::getConstraints in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ NumericItemBase.php - Gets a list of validation constraints.
- StringItem::getConstraints in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ StringItem.php - Gets a list of validation constraints.
File
- core/
lib/ Drupal/ Core/ TypedData/ TypedData.php, line 119
Class
- TypedData
- The abstract base class for typed data.
Namespace
Drupal\Core\TypedDataCode
public function getConstraints() {
$constraint_manager = $this
->getTypedDataManager()
->getValidationConstraintManager();
$constraints = [];
foreach ($this->definition
->getConstraints() as $name => $options) {
$constraints[] = $constraint_manager
->create($name, $options);
}
return $constraints;
}