You are here

public function GroupIdFromUrl::getCacheContexts in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views/argument_default/GroupIdFromUrl.php \Drupal\group\Plugin\views\argument_default\GroupIdFromUrl::getCacheContexts()

The cache contexts associated with this object.

These identify a specific variation/representation of the object.

Cache contexts are tokens: placeholders that are converted to cache keys by the @cache_contexts_manager service. The replacement value depends on the request context (the current URL, language, and so on). They're converted before storing an object in cache.

Return value

string[] An array of cache context tokens, used to generate a cache ID.

Overrides CacheableDependencyInterface::getCacheContexts

See also

\Drupal\Core\Cache\Context\CacheContextsManager::convertTokensToKeys()

File

src/Plugin/views/argument_default/GroupIdFromUrl.php, line 79

Class

GroupIdFromUrl
Default argument plugin to extract a group ID.

Namespace

Drupal\group\Plugin\views\argument_default

Code

public function getCacheContexts() {

  // We cache the result on the route instead of the URL so that path aliases
  // can all use the same cache context. If you look at ::getArgument() you'll
  // see that we actually get the group ID from the route, not the URL.
  return [
    'route',
  ];
}