You are here

protected function LayoutBuilderIsActiveCacheContext::getDisplay in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Cache/LayoutBuilderIsActiveCacheContext.php \Drupal\layout_builder\Cache\LayoutBuilderIsActiveCacheContext::getDisplay()

Returns the entity view display for a given entity type and view mode.

Parameters

string $entity_type_id: The entity type ID.

Return value

\Drupal\layout_builder\Entity\LayoutEntityDisplayInterface|null The entity view display, if it exists.

2 calls to LayoutBuilderIsActiveCacheContext::getDisplay()
LayoutBuilderIsActiveCacheContext::getCacheableMetadata in core/modules/layout_builder/src/Cache/LayoutBuilderIsActiveCacheContext.php
Gets the cacheability metadata for the context based on the parameter value.
LayoutBuilderIsActiveCacheContext::getContext in core/modules/layout_builder/src/Cache/LayoutBuilderIsActiveCacheContext.php
Returns the string representation of the cache context.

File

core/modules/layout_builder/src/Cache/LayoutBuilderIsActiveCacheContext.php, line 82

Class

LayoutBuilderIsActiveCacheContext
Determines whether Layout Builder is active for a given entity type or not.

Namespace

Drupal\layout_builder\Cache

Code

protected function getDisplay($entity_type_id) {
  if ($entity = $this->routeMatch
    ->getParameter($entity_type_id)) {
    if ($entity instanceof OverridesSectionStorageInterface) {
      return $entity
        ->getDefaultSectionStorage();
    }
  }
}