class RouteNameCacheContext in Drupal 8
Same name and namespace in other branches
- 9 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 CacheContextInterface
- class \Drupal\Core\Cache\Context\RouteNameCacheContext
Expanded class hierarchy of RouteNameCacheContext
1 file declares its use of RouteNameCacheContext
- LayoutBuilderUiCacheContext.php in core/
modules/ layout_builder/ src/ Cache/ LayoutBuilderUiCacheContext.php
1 string reference to 'RouteNameCacheContext'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses RouteNameCacheContext
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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteCacheContext:: |
protected | property | The route match. | |
RouteCacheContext:: |
public | function |
Gets the cacheability metadata for the context. Overrides CacheContextInterface:: |
|
RouteCacheContext:: |
public | function | Constructs a new RouteCacheContext class. | |
RouteNameCacheContext:: |
public | function |
Returns the string representation of the cache context. Overrides RouteCacheContext:: |
1 |
RouteNameCacheContext:: |
public static | function |
Returns the label of the cache context. Overrides RouteCacheContext:: |
1 |