function EntityBundle::applyConstraints
Same name in other branches
- 8.x-3.x src/Plugin/Condition/EntityBundle.php \Drupal\ctools\Plugin\Condition\EntityBundle::applyConstraints()
Parameters
\Drupal\Core\Plugin\Context\ContextInterface[] $contexts:
Overrides ConstraintConditionInterface::applyConstraints
File
-
src/
Plugin/ Condition/ EntityBundle.php, line 146
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 plugin type.
foreach ($this->getContextMapping() as $definition_id => $context_id) {
$contexts[$context_id]->getContextDefinition()
->addConstraint('Bundle', [
'value' => $bundle,
]);
}
}