protected function Context::setContextValue in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::setContextValue()
Sets the context value.
Parameters
mixed $value: The value of this context, matching the context definition.
2 calls to Context::setContextValue()
- Context::getContextValue in core/lib/ Drupal/ Core/ Plugin/ Context/ Context.php 
- Gets the context value.
- Context::__construct in core/lib/ Drupal/ Core/ Plugin/ Context/ Context.php 
- Create a context object.
File
- core/lib/ Drupal/ Core/ Plugin/ Context/ Context.php, line 96 
- Contains \Drupal\Core\Plugin\Context\Context.
Class
- Context
- A Drupal specific context wrapper class.
Namespace
Drupal\Core\Plugin\ContextCode
protected function setContextValue($value) {
  // Add the value as a cacheable dependency only if implements the interface
  // to prevent it from disabling caching with a max-age 0.
  if ($value instanceof CacheableDependencyInterface) {
    $this
      ->addCacheableDependency($value);
  }
  if ($value instanceof TypedDataInterface) {
    $this->contextData = $value;
  }
  else {
    $this->contextData = $this
      ->getTypedDataManager()
      ->create($this->contextDefinition
      ->getDataDefinition(), $value);
  }
}