class PrivateMessageThreadCacheContext in Private Message 8
Same name and namespace in other branches
- 8.2 src/Cache/Context/PrivateMessageThreadCacheContext.php \Drupal\private_message\Cache\Context\PrivateMessageThreadCacheContext
Defines the PrivateMessageThread service, for "per thread" caching.
Cache context ID: 'private_message_thread'.
Hierarchy
- class \Drupal\private_message\Cache\Context\PrivateMessageThreadCacheContext implements CacheContextInterface
Expanded class hierarchy of PrivateMessageThreadCacheContext
1 string reference to 'PrivateMessageThreadCacheContext'
File
- src/
Cache/ Context/ PrivateMessageThreadCacheContext.php, line 14
Namespace
Drupal\private_message\Cache\ContextView source
class PrivateMessageThreadCacheContext implements CacheContextInterface {
/**
* The current route matcher.
*
* @var \Drupal\Core\Routing\ResettableStackedRouteMatchInterface
*/
protected $currentRouteMatcher;
/**
* Constructs a new UserCacheContextBase class.
*
* @param \Drupal\Core\Routing\ResettableStackedRouteMatchInterface $currentRouteMatcher
* The current route matcher.
*/
public function __construct(ResettableStackedRouteMatchInterface $currentRouteMatcher) {
$this->currentRouteMatcher = $currentRouteMatcher;
}
/**
* {@inheritdoc}
*/
public static function getLabel() {
return t('Private Message Thread');
}
/**
* {@inheritdoc}
*/
public function getContext() {
$thread = $this->currentRouteMatcher
->getParameter('private_message_thread');
if ($thread) {
return $thread
->id();
}
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata() {
return new CacheableMetadata();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PrivateMessageThreadCacheContext:: |
protected | property | The current route matcher. | |
PrivateMessageThreadCacheContext:: |
public | function |
Gets the cacheability metadata for the context. Overrides CacheContextInterface:: |
|
PrivateMessageThreadCacheContext:: |
public | function |
Returns the string representation of the cache context. Overrides CacheContextInterface:: |
|
PrivateMessageThreadCacheContext:: |
public static | function |
Returns the label of the cache context. Overrides CacheContextInterface:: |
|
PrivateMessageThreadCacheContext:: |
public | function | Constructs a new UserCacheContextBase class. |