function DefaultsSectionStorage::getEntityTypes

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage::getEntityTypes()
  2. 10 core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage::getEntityTypes()
  3. 11.x core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage::getEntityTypes()

Returns an array of relevant entity types.

Return value

\Drupal\Core\Entity\EntityTypeInterface[] An array of entity types.

1 call to DefaultsSectionStorage::getEntityTypes()
DefaultsSectionStorage::buildRoutes in core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php
Provides the routes needed for Layout Builder UI.

File

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

Class

DefaultsSectionStorage
Defines the 'defaults' section storage type.

Namespace

Drupal\layout_builder\Plugin\SectionStorage

Code

protected function getEntityTypes() {
    return array_filter($this->entityTypeManager
        ->getDefinitions(), function (EntityTypeInterface $entity_type) {
        return $entity_type->entityClassImplements(FieldableEntityInterface::class) && $entity_type->hasHandlerClass('form', 'layout_builder') && $entity_type->hasViewBuilderClass() && $entity_type->get('field_ui_base_route');
    });
}

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