class RouteNameCacheContext
Same name in other branches
- 9 core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php \Drupal\Core\Cache\Context\RouteNameCacheContext
- 8.9.x core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php \Drupal\Core\Cache\Context\RouteNameCacheContext
- 10 core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php \Drupal\Core\Cache\Context\RouteNameCacheContext
Defines the RouteCacheContext service, for "per route name" caching.
Cache context ID: 'route.name'.
Hierarchy
- class \Drupal\Core\Cache\Context\RouteCacheContext implements \Drupal\Core\Cache\Context\CacheContextInterface
- class \Drupal\Core\Cache\Context\RouteNameCacheContext extends \Drupal\Core\Cache\Context\RouteCacheContext
Expanded class hierarchy of RouteNameCacheContext
1 file declares its use of RouteNameCacheContext
- LayoutBuilderUiCacheContext.php in core/
modules/ layout_builder/ src/ Cache/ LayoutBuilderUiCacheContext.php
File
-
core/
lib/ Drupal/ Core/ Cache/ Context/ RouteNameCacheContext.php, line 10
Namespace
Drupal\Core\Cache\ContextView source
class RouteNameCacheContext extends RouteCacheContext {
/**
* {@inheritdoc}
*/
public static function getLabel() {
return t('Route name');
}
/**
* {@inheritdoc}
*/
public function getContext() {
return $this->routeMatch
->getRouteName();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
RouteCacheContext::$routeMatch | protected | property | The route match. | ||
RouteCacheContext::getCacheableMetadata | public | function | Overrides CacheContextInterface::getCacheableMetadata | ||
RouteCacheContext::__construct | public | function | Constructs a new RouteCacheContext class. | ||
RouteNameCacheContext::getContext | public | function | Overrides RouteCacheContext::getContext | 1 | |
RouteNameCacheContext::getLabel | public static | function | Overrides RouteCacheContext::getLabel | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.