class LayoutBuilderUiCacheContext
Same name in other branches
- 9 core/modules/layout_builder/src/Cache/LayoutBuilderUiCacheContext.php \Drupal\layout_builder\Cache\LayoutBuilderUiCacheContext
- 8.9.x core/modules/layout_builder/src/Cache/LayoutBuilderUiCacheContext.php \Drupal\layout_builder\Cache\LayoutBuilderUiCacheContext
- 11.x core/modules/layout_builder/src/Cache/LayoutBuilderUiCacheContext.php \Drupal\layout_builder\Cache\LayoutBuilderUiCacheContext
Determines if an entity is being viewed in the Layout Builder UI.
Cache context ID: 'route.name.is_layout_builder_ui'.
@internal Tagged services are internal.
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
- class \Drupal\layout_builder\Cache\LayoutBuilderUiCacheContext extends \Drupal\Core\Cache\Context\RouteNameCacheContext
- class \Drupal\Core\Cache\Context\RouteNameCacheContext extends \Drupal\Core\Cache\Context\RouteCacheContext
Expanded class hierarchy of LayoutBuilderUiCacheContext
1 string reference to 'LayoutBuilderUiCacheContext'
- layout_builder.services.yml in core/
modules/ layout_builder/ layout_builder.services.yml - core/modules/layout_builder/layout_builder.services.yml
1 service uses LayoutBuilderUiCacheContext
- cache_context.route.name.is_layout_builder_ui in core/
modules/ layout_builder/ layout_builder.services.yml - Drupal\layout_builder\Cache\LayoutBuilderUiCacheContext
File
-
core/
modules/ layout_builder/ src/ Cache/ LayoutBuilderUiCacheContext.php, line 15
Namespace
Drupal\layout_builder\CacheView source
class LayoutBuilderUiCacheContext extends RouteNameCacheContext {
/**
* {@inheritdoc}
*/
public static function getLabel() {
return t('Layout Builder user interface');
}
/**
* {@inheritdoc}
*/
public function getContext() {
$route_name = $this->routeMatch
->getRouteName();
if ($route_name && str_starts_with($route_name, 'layout_builder.')) {
return 'is_layout_builder_ui.0';
}
return 'is_layout_builder_ui.1';
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
LayoutBuilderUiCacheContext::getContext | public | function | Returns the string representation of the cache context. | Overrides RouteNameCacheContext::getContext |
LayoutBuilderUiCacheContext::getLabel | public static | function | Returns the label of the cache context. | Overrides RouteNameCacheContext::getLabel |
RouteCacheContext::$routeMatch | protected | property | The route match. | |
RouteCacheContext::getCacheableMetadata | public | function | Overrides CacheContextInterface::getCacheableMetadata | |
RouteCacheContext::__construct | public | function | Constructs a new RouteCacheContext class. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.