You are here

public function RouteNameCacheContext::getContext in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php \Drupal\Core\Cache\Context\RouteNameCacheContext::getContext()

Returns the string representation of the cache context.

A cache context service's name is used as a token (placeholder) cache key, and is then replaced with the string returned by this method.

Return value

string The string representation of the cache context.

Overrides RouteCacheContext::getContext

1 method overrides RouteNameCacheContext::getContext()
LayoutBuilderUiCacheContext::getContext in core/modules/layout_builder/src/Cache/LayoutBuilderUiCacheContext.php
Returns the string representation of the cache context.

File

core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php, line 22

Class

RouteNameCacheContext
Defines the RouteCacheContext service, for "per route name" caching.

Namespace

Drupal\Core\Cache\Context

Code

public function getContext() {
  return $this->routeMatch
    ->getRouteName();
}