function TypedDataManagerInterface::getDefaultConstraints
Same name in other branches
- 8.9.x core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php \Drupal\Core\TypedData\TypedDataManagerInterface::getDefaultConstraints()
- 10 core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php \Drupal\Core\TypedData\TypedDataManagerInterface::getDefaultConstraints()
- 11.x core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php \Drupal\Core\TypedData\TypedDataManagerInterface::getDefaultConstraints()
Gets default constraints for the given data definition.
This generates default constraint definitions based on the data definition; for example, a NotNull constraint is generated if the data is defined as required. Besides that, any constraints defined for the data type (that is, below the 'constraint' key of the type's plugin definition) are taken into account.
Parameters
\Drupal\Core\TypedData\DataDefinitionInterface $definition: A data definition.
Return value
array An array of validation constraint definitions, keyed by constraint name. Each constraint definition can be used for instantiating \Symfony\Component\Validator\Constraint objects.
1 method overrides TypedDataManagerInterface::getDefaultConstraints()
- TypedDataManager::getDefaultConstraints in core/
lib/ Drupal/ Core/ TypedData/ TypedDataManager.php - Gets default constraints for the given data definition.
File
-
core/
lib/ Drupal/ Core/ TypedData/ TypedDataManagerInterface.php, line 217
Class
- TypedDataManagerInterface
- Defines an interface for typed data manager.
Namespace
Drupal\Core\TypedDataCode
public function getDefaultConstraints(DataDefinitionInterface $definition);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.