function EntityBundleConstraint::applyConstraints
Parameters
\Drupal\Core\Plugin\Context\ContextInterface[] $contexts:
Overrides ConstraintConditionInterface::applyConstraints
File
-
src/
Plugin/ Condition/ EntityBundleConstraint.php, line 20
Class
- EntityBundleConstraint
- Entity Bundle Constraints
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 plugin type.
foreach ($this->getContextMapping() as $definition_id => $context_id) {
$contexts[$context_id]->getContextDefinition()
->addConstraint('Bundle', [
'value' => $bundle,
]);
}
}