function ContextDefinition::getConstraintObjects
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::getConstraintObjects()
- 10 core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::getConstraintObjects()
- 11.x core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::getConstraintObjects()
Extracts an array of constraints for a context definition object.
Return value
\Symfony\Component\Validator\Constraint[] A list of applied constraints for the context definition.
2 calls to ContextDefinition::getConstraintObjects()
- ContextDefinition::isSatisfiedBy in core/
lib/ Drupal/ Core/ Plugin/ Context/ ContextDefinition.php - Determines if this definition is satisfied by a context object.
- EntityContextDefinition::getConstraintObjects in core/
lib/ Drupal/ Core/ Plugin/ Context/ EntityContextDefinition.php - Extracts an array of constraints for a context definition object.
1 method overrides ContextDefinition::getConstraintObjects()
- EntityContextDefinition::getConstraintObjects in core/
lib/ Drupal/ Core/ Plugin/ Context/ EntityContextDefinition.php - Extracts an array of constraints for a context definition object.
File
-
core/
lib/ Drupal/ Core/ Plugin/ Context/ ContextDefinition.php, line 354
Class
- ContextDefinition
- Defines a class for context definitions.
Namespace
Drupal\Core\Plugin\ContextCode
protected function getConstraintObjects() {
$constraint_definitions = $this->getConstraints();
$validation_constraint_manager = $this->getTypedDataManager()
->getValidationConstraintManager();
$constraints = [];
foreach ($constraint_definitions as $constraint_name => $constraint_definition) {
$constraints[$constraint_name] = $validation_constraint_manager->create($constraint_name, $constraint_definition);
}
return $constraints;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.