function OverridesSectionStorage::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/ OverridesSectionStorage.php, line 409
Class
- OverridesSectionStorage
- Defines the 'overrides' section storage type.
Namespace
Drupal\layout_builder\Plugin\SectionStorageCode
public function isSupported(string $entity_type_id, string $bundle, string $view_mode) : bool {
// Layout builder currently only supports the default view mode.
// @see https://www.drupal.org/node/2907413
if ($view_mode !== 'default') {
return FALSE;
}
$id = "{$entity_type_id}.{$bundle}.{$view_mode}";
$storage = $this->entityTypeManager
->getStorage('entity_view_display');
$display = $storage->load($id);
return $display instanceof LayoutEntityDisplayInterface && $display->isOverridable();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.