You are here

public function LayoutBuilderUiCacheContext::getContext in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Cache/LayoutBuilderUiCacheContext.php \Drupal\layout_builder\Cache\LayoutBuilderUiCacheContext::getContext()
  2. 9 core/modules/layout_builder/src/Cache/LayoutBuilderUiCacheContext.php \Drupal\layout_builder\Cache\LayoutBuilderUiCacheContext::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 RouteNameCacheContext::getContext

File

core/modules/layout_builder/src/Cache/LayoutBuilderUiCacheContext.php, line 27

Class

LayoutBuilderUiCacheContext
Determines if an entity is being viewed in the Layout Builder UI.

Namespace

Drupal\layout_builder\Cache

Code

public function getContext() {
  return 'is_layout_builder_ui.' . (int) (strpos($this->routeMatch
    ->getRouteName(), 'layout_builder.') !== 0);
}