Add route cache context to related posts block

References #3
This commit is contained in:
Oliver Davies 2021-01-11 02:32:17 +00:00
parent a3e8f03cf1
commit dee6051cd9

View file

@ -80,6 +80,10 @@ class RelatedPostsBlock extends BlockBase implements ContainerFactoryPluginInter
return 604800;
}
public function getCacheContexts(): array {
return Cache::mergeContexts(parent::getCacheContexts(), ['route']);
}
public function getCacheTags(): array {
/** @var Post $post */
$post = $this->currentRouteMatch->getParameter('node');