/** * {@inheritdoc} */ public function getCacheContexts() { // The block by itself doesn't really vary by user, but some of its // implementations are (collection module, I'm looking at you). For the sake // of semplicity, we add the user context here already. $contexts = parent::getCacheContexts(); return Cache::mergeContexts($contexts, ['user']); }
/** * {@inheritdoc} */ public function getCacheContexts() { return Cache::mergeContexts(parent::getCacheContexts(), ['route.book_navigation']); }
/** * {@inheritdoc} */ public function getCacheContexts() { return Cache::mergeContexts(parent::getCacheContexts(), ['route']); }
/** * {@inheritdoc} */ public function getCacheContexts() { return Cache::mergeContexts(parent::getCacheContexts(), ['user.node_grants:view']); }
/** * {@inheritdoc} */ public function getCacheContexts() { // ::build() uses MenuLinkTreeInterface::getCurrentRouteMenuTreeParameters() // to generate menu tree parameters, and those take the active menu trail // into account. Therefore, we must vary the rendered menu by the active // trail of the rendered menu. // Additional cache contexts, e.g. those that determine link text or // accessibility of a menu, will be bubbled automatically. $menu_name = $this->getDerivativeId(); return Cache::mergeContexts(parent::getCacheContexts(), ['route.menu_active_trails:' . $menu_name]); }
/** * {@inheritdoc} */ public function getCacheContexts() { return Cache::mergeContexts(parent::getCacheContexts(), ['is_masquerading']); }
/** * {@inheritdoc} */ public function getCacheContexts() { $context = parent::getCacheContexts(); // The links are only visible for certain roles on certain collections. // Normally cache contexts are added automatically but these links depend on // an optional context which we manage ourselves. return Cache::mergeContexts($context, ['user', 'user.roles', 'collection', 'asset_release', 'solution', 'url.path']); }
/** * {@inheritdoc} */ public function getCacheContexts() { // The "Help" block must be cached per URL: help is defined for a // given path, and does not come with any access restrictions. return Cache::mergeContexts(parent::getCacheContexts(), ['url']); }
/** * Implements \Drupal\Core\Entity\Entity::getCacheContexts(). */ public function getCacheContexts() { return Cache::mergeContexts(parent::getCacheContexts(), array('route')); }
/** * {@inheritdoc} */ public function getCacheContexts() { $parent_context = parent::getCacheContexts(); return Cache::mergeContexts($parent_context, $this->ivwTracker->getCacheContexts()); }