public function EntityBundle::applyConstraints in Chaos Tool Suite (ctools) 8.3
Parameters
\Drupal\Core\Plugin\Context\ContextInterface[] $contexts:
Overrides ConstraintConditionInterface::applyConstraints
File
- src/
Plugin/ Condition/ EntityBundle.php, line 141
Class
- EntityBundle
- Provides a 'Entity Bundle' condition.
Namespace
Drupal\ctools\Plugin\ConditionCode
public function applyConstraints(array $contexts = []) {
// Nullify any bundle constraints on contexts we care about.
$this
->removeConstraints($contexts);
$bundle = array_values($this->configuration['bundles']);
// There's only one expected context for this plugint type.
foreach ($this
->getContextMapping() as $definition_id => $context_id) {
$contexts[$context_id]
->getContextDefinition()
->addConstraint('Bundle', [
'value' => $bundle,
]);
}
}