function LayoutBuilderIsActiveCacheContext::getDisplay

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Cache/LayoutBuilderIsActiveCacheContext.php \Drupal\layout_builder\Cache\LayoutBuilderIsActiveCacheContext::getDisplay()
  2. 10 core/modules/layout_builder/src/Cache/LayoutBuilderIsActiveCacheContext.php \Drupal\layout_builder\Cache\LayoutBuilderIsActiveCacheContext::getDisplay()
  3. 11.x 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();
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.