function ConditionPluginCollection::addContext

Same name in other branches
  1. 9 core/lib/Drupal/Core/Condition/ConditionPluginCollection.php \Drupal\Core\Condition\ConditionPluginCollection::addContext()
  2. 8.9.x core/lib/Drupal/Core/Condition/ConditionPluginCollection.php \Drupal\Core\Condition\ConditionPluginCollection::addContext()
  3. 10 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 69

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.