You are here

public function RngEventCacheContext::getContext 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::getContext()
  2. 8 src/Cache/Context/RngEventCacheContext.php \Drupal\rng\Cache\Context\RngEventCacheContext::getContext()

Returns the string representation of the cache context.

A cache context service's name is used as a token (placeholder) cache key, and is then replaced with the string returned by this method.

Return value

string The string representation of the cache context.

Overrides CacheContextInterface::getContext

File

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

Class

RngEventCacheContext
A context for the current rng_event.

Namespace

Drupal\rng\Cache\Context

Code

public function getContext() {
  if (isset($this->rng_event)) {
    return $this->rng_event
      ->getEntityTypeId() . ':' . $this->rng_event
      ->id();
  }
  return '';
}