public function ContextDefinition::setConstraints in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::setConstraints()
- 9 core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::setConstraints()
Sets the array of validation constraints.
NOTE: This will override any previously set constraints. In most cases ContextDefinitionInterface::addConstraint() should be used instead.
Parameters
array $constraints: The array of constraints.
Return value
$this
Overrides ContextDefinitionInterface::setConstraints
See also
File
- core/
lib/ Drupal/ Core/ Plugin/ Context/ ContextDefinition.php, line 227
Class
- ContextDefinition
- Defines a class for context definitions.
Namespace
Drupal\Core\Plugin\ContextCode
public function setConstraints(array $constraints) {
$this->constraints = $constraints;
return $this;
}