Exemplo n.º 1
0
 /**
  * {@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;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getCacheContexts()
 {
     $contexts = parent::getCacheContexts();
     $contexts[] = 'url.path';
     return $contexts;
 }
Exemplo n.º 3
0
 /**
  * {@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;
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function getCacheContexts()
 {
     $contexts = parent::getCacheContexts();
     $contexts[] = 'theme';
     return $contexts;
 }