function Context::__construct
Same name in this branch
- 8.9.x core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::__construct()
Same name in other branches
- 9 core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::__construct()
- 9 core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::__construct()
- 10 core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::__construct()
- 10 core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::__construct()
- 11.x core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::__construct()
- 11.x core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::__construct()
Create a context object.
Parameters
\Drupal\Core\Plugin\Context\ContextDefinitionInterface $context_definition: The context definition.
mixed|null $context_value: The context value object.
Overrides Context::__construct
File
-
core/
lib/ Drupal/ Core/ Plugin/ Context/ Context.php, line 50
Class
- Context
- A Drupal specific context wrapper class.
Namespace
Drupal\Core\Plugin\ContextCode
public function __construct(ContextDefinitionInterface $context_definition, $context_value = NULL) {
parent::__construct($context_definition, NULL);
$this->cacheabilityMetadata = new CacheableMetadata();
if (!is_null($context_value)) {
$this->setContextValue($context_value);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.