protected function EntityContextDefinition::getConstraintObjects in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::getConstraintObjects()
- 10 core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::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.
Overrides ContextDefinition::getConstraintObjects
1 call to EntityContextDefinition::getConstraintObjects()
- EntityContextDefinition::getSampleValues in core/
lib/ Drupal/ Core/ Plugin/ Context/ EntityContextDefinition.php - Returns typed data objects representing this context definition.
File
- core/
lib/ Drupal/ Core/ Plugin/ Context/ EntityContextDefinition.php, line 43
Class
- EntityContextDefinition
- Defines a class to provide entity context definitions.
Namespace
Drupal\Core\Plugin\ContextCode
protected function getConstraintObjects() {
if (!$this
->getConstraint('EntityType')) {
$this
->addConstraint('EntityType', [
'type' => $this
->getEntityTypeId(),
]);
}
return parent::getConstraintObjects();
}