function EntityBundle::removeConstraints

Same name in other branches
  1. 8.x-3.x src/Plugin/Condition/EntityBundle.php \Drupal\ctools\Plugin\Condition\EntityBundle::removeConstraints()

Parameters

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

Overrides ConstraintConditionInterface::removeConstraints

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

File

src/Plugin/Condition/EntityBundle.php, line 161

Class

EntityBundle
Provides a 'Entity Bundle' condition.

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);
    }
}