function EntityBundleConstraint::removeConstraints

Parameters

\Drupal\Core\Plugin\Context\ContextInterface[] $contexts:

Overrides ConstraintConditionInterface::removeConstraints

1 call to EntityBundleConstraint::removeConstraints()
EntityBundleConstraint::applyConstraints in src/Plugin/Condition/EntityBundleConstraint.php

File

src/Plugin/Condition/EntityBundleConstraint.php, line 35

Class

EntityBundleConstraint
Entity Bundle Constraints

Namespace

Drupal\ctools\Plugin\Condition

Code

public function removeConstraints(array $contexts = []) {
    // Reset the bundle constraint for any context we've mapped.
    foreach ($this->getContextMapping() as $definition_id => $context_id) {
        $constraints = $contexts[$context_id]->getContextDefinition()
            ->getConstraints();
        unset($constraints['Bundle']);
        $contexts[$context_id]->getContextDefinition()
            ->setConstraints($constraints);
    }
}