function ConditionPluginCollection::addContext

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Condition/ConditionPluginCollection.php \Drupal\Core\Condition\ConditionPluginCollection::addContext()
  2. 10 core/lib/Drupal/Core/Condition/ConditionPluginCollection.php \Drupal\Core\Condition\ConditionPluginCollection::addContext()
  3. 11.x core/lib/Drupal/Core/Condition/ConditionPluginCollection.php \Drupal\Core\Condition\ConditionPluginCollection::addContext()

Sets the condition context for a given name.

Parameters

string $name: The name of the context.

\Drupal\Component\Plugin\Context\ContextInterface $context: The context to add.

Return value

$this

File

core/lib/Drupal/Core/Condition/ConditionPluginCollection.php, line 64

Class

ConditionPluginCollection
Provides a collection of condition plugins.

Namespace

Drupal\Core\Condition

Code

public function addContext($name, ContextInterface $context) {
    $this->conditionContexts[$name] = $context;
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.