You are here

class LayoutBuilderUiCacheContext in Drupal 9

Same name and namespace in other branches
  1. 8 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

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\Cache
View source
class LayoutBuilderUiCacheContext extends RouteNameCacheContext {

  /**
   * {@inheritdoc}
   */
  public static function getLabel() {
    return t('Layout Builder user interface');
  }

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

}

Members

Namesort descending Modifiers Type Description Overrides
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 Gets the cacheability metadata for the context. Overrides CacheContextInterface::getCacheableMetadata
RouteCacheContext::__construct public function Constructs a new RouteCacheContext class.