Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LayoutBuilderUiCacheContext.php

function LayoutBuilderUiCacheContext::getContext

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() {
    $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';
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal