function DataDefinition::setConstraints
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::setConstraints()
- 10 core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::setConstraints()
- 11.x core/lib/Drupal/Core/TypedData/DataDefinition.php \Drupal\Core\TypedData\DataDefinition::setConstraints()
Sets an array of validation constraints.
Parameters
array $constraints: An array of validation constraint definitions, keyed by constraint name. Each constraint definition can be used for instantiating \Symfony\Component\Validator\Constraint objects.
Return value
$this
File
-
core/
lib/ Drupal/ Core/ TypedData/ DataDefinition.php, line 285
Class
- DataDefinition
- A typed data definition class for defining data based on defined data types.
Namespace
Drupal\Core\TypedDataCode
public function setConstraints(array $constraints) {
$this->definition['constraints'] = $constraints;
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.