You are here

public function RngEventCacheContext::__construct in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/Cache/Context/RngEventCacheContext.php \Drupal\rng\Cache\Context\RngEventCacheContext::__construct()
  2. 8 src/Cache/Context/RngEventCacheContext.php \Drupal\rng\Cache\Context\RngEventCacheContext::__construct()

Constructs a new RngEventCacheContext service..

Parameters

\Drupal\Core\Plugin\Context\ContextProviderInterface $context_provider: The rng_event context service.

File

src/Cache/Context/RngEventCacheContext.php, line 29

Class

RngEventCacheContext
A context for the current rng_event.

Namespace

Drupal\rng\Cache\Context

Code

public function __construct(ContextProviderInterface $context_provider) {

  /** @var \Drupal\rng\ContextProvider\RngEventRouteContext $context_provider */
  $contexts = $context_provider
    ->getRuntimeContexts([
    'rng_event',
  ]);
  $this->rng_event = $contexts['rng_event']
    ->getContextValue();
}