function Context::__construct

Same name in this branch
  1. 11.x core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::__construct()
Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::__construct()
  2. 9 core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::__construct()
  3. 8.9.x core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::__construct()
  4. 8.9.x core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::__construct()
  5. 10 core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::__construct()
  6. 10 core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::__construct()

Create a context object.

Parameters

\Drupal\Component\Plugin\Context\ContextDefinitionInterface $context_definition: The context definition.

mixed|null $context_value: The value of the context.

1 call to Context::__construct()
Context::__construct in core/lib/Drupal/Core/Plugin/Context/Context.php
Create a context object.
1 method overrides Context::__construct()
Context::__construct in core/lib/Drupal/Core/Plugin/Context/Context.php
Create a context object.

File

core/lib/Drupal/Component/Plugin/Context/Context.php, line 36

Class

Context
A generic context class for wrapping data a plugin needs to operate.

Namespace

Drupal\Component\Plugin\Context

Code

public function __construct(ContextDefinitionInterface $context_definition, $context_value = NULL) {
    $this->contextDefinition = $context_definition;
    $this->contextValue = $context_value;
}

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