/** * {@inheritdoc} */ public function getCacheContexts() { // Optimize cache context, if a user cache context is provided, only use // user.roles, since that's the only part this condition cares about. $contexts = []; foreach (parent::getCacheContexts() as $context) { $contexts[] = $context == 'user' ? 'user.roles' : $context; } return $contexts; }
/** * {@inheritdoc} */ public function getCacheContexts() { $contexts = parent::getCacheContexts(); $contexts[] = 'url.path'; return $contexts; }
/** * {@inheritdoc} */ public function getCacheContexts() { $contexts = parent::getCacheContexts(); // @todo Add a url.path cache context in // https://www.drupal.org/node/2521978. $contexts[] = 'url'; return $contexts; }
/** * {@inheritdoc} */ public function getCacheContexts() { $contexts = parent::getCacheContexts(); $contexts[] = 'theme'; return $contexts; }