PrivateMessageThreadCacheContext.php in Private Message 8
File
src/Cache/Context/PrivateMessageThreadCacheContext.php
View source
<?php
namespace Drupal\private_message\Cache\Context;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\Context\CacheContextInterface;
use Drupal\Core\Routing\ResettableStackedRouteMatchInterface;
class PrivateMessageThreadCacheContext implements CacheContextInterface {
protected $currentRouteMatcher;
public function __construct(ResettableStackedRouteMatchInterface $currentRouteMatcher) {
$this->currentRouteMatcher = $currentRouteMatcher;
}
public static function getLabel() {
return t('Private Message Thread');
}
public function getContext() {
$thread = $this->currentRouteMatcher
->getParameter('private_message_thread');
if ($thread) {
return $thread
->id();
}
}
public function getCacheableMetadata() {
return new CacheableMetadata();
}
}