protected function ContextDefinition::getConstraintObjects in Drupal 9
Same name and namespace in other branches
- 8 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 345
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;
}