public function Context::setContextValue

Same name in this branch
  1. 8.x drupal/core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::setContextValue()
  2. 8.x drupal/core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::setContextValue()

Implements \Drupal\Component\Plugin\Context\ContextInterface::setContextValue().

Overrides Context::setContextValue

File

drupal/core/lib/Drupal/Core/Plugin/Context/Context.php, line 49
Contains \Drupal\Core\Plugin\Context\Context.

Class

Context
A Drupal specific context wrapper class.

Namespace

Drupal\Core\Plugin\Context

Code

public function setContextValue($value) {

  // Make sure the value set is a typed data object.
  if (!empty($this->contextDefinition['type']) && !$value instanceof TypedDataInterface) {
    $value = \Drupal::typedData()
      ->create($this->contextDefinition, $value);
  }
  parent::setContextValue($value);
}