You are here

public function PrivateMessageThreadCacheContext::getContext in Private Message 8

Same name and namespace in other branches
  1. 8.2 src/Cache/Context/PrivateMessageThreadCacheContext.php \Drupal\private_message\Cache\Context\PrivateMessageThreadCacheContext::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/PrivateMessageThreadCacheContext.php, line 43

Class

PrivateMessageThreadCacheContext
Defines the PrivateMessageThread service, for "per thread" caching.

Namespace

Drupal\private_message\Cache\Context

Code

public function getContext() {
  $thread = $this->currentRouteMatcher
    ->getParameter('private_message_thread');
  if ($thread) {
    return $thread
      ->id();
  }
}