function DefaultsSectionStorage::isSupported

Determines if layout builder is supported by a view mode.

Parameters

string $entity_type_id: The entity type id.

string $bundle: The bundle.

string $view_mode: The view mode.

Return value

bool TRUE if it is supported, otherwise FALSE.

Overrides SupportAwareSectionStorageInterface::isSupported

File

core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php, line 420

Class

DefaultsSectionStorage
Defines the 'defaults' section storage type.

Namespace

Drupal\layout_builder\Plugin\SectionStorage

Code

public function isSupported(string $entity_type_id, string $bundle, string $view_mode) : bool {
  $id = "{$entity_type_id}.{$bundle}.{$view_mode}";
  $storage = $this->entityTypeManager
    ->getStorage('entity_view_display');
  $display = $storage->load($id) ?? $storage->load("{$entity_type_id}.{$bundle}.default");
  return $display instanceof LayoutBuilderEnabledInterface && $display->isLayoutBuilderEnabled();
}

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