W3cubDocs

/Drupal 8

public function TypedDataManagerInterface::getDefaultConstraints

public TypedDataManagerInterface::getDefaultConstraints(DataDefinitionInterface $definition)

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.

File

core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php, line 217

Class

TypedDataManagerInterface
Defines an interface for typed data manager.

Namespace

Drupal\Core\TypedData

Code

public function getDefaultConstraints(DataDefinitionInterface $definition);

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!TypedData!TypedDataManagerInterface.php/function/TypedDataManagerInterface::getDefaultConstraints/8.1.x