function ExtraFieldBlockDeriver::bundleIdsWithLayoutBuilderDisplays

Same name in other branches
  1. 10 core/modules/layout_builder/src/Plugin/Derivative/ExtraFieldBlockDeriver.php \Drupal\layout_builder\Plugin\Derivative\ExtraFieldBlockDeriver::bundleIdsWithLayoutBuilderDisplays()

Gets a list of entity type and bundle tuples that have layout builder enabled.

Return value

array A structured array with entity type as first key, bundle as second.

1 call to ExtraFieldBlockDeriver::bundleIdsWithLayoutBuilderDisplays()
ExtraFieldBlockDeriver::getDerivativeDefinitions in core/modules/layout_builder/src/Plugin/Derivative/ExtraFieldBlockDeriver.php
Gets the definition of all derivatives of a base plugin.

File

core/modules/layout_builder/src/Plugin/Derivative/ExtraFieldBlockDeriver.php, line 154

Class

ExtraFieldBlockDeriver
Provides entity field block definitions for every field.

Namespace

Drupal\layout_builder\Plugin\Derivative

Code

protected function bundleIdsWithLayoutBuilderDisplays() : array {
    
    /** @var \Drupal\layout_builder\Entity\LayoutEntityDisplayInterface[] $displays */
    $displays = $this->entityTypeManager
        ->getStorage('entity_view_display')
        ->loadByProperties([
        'third_party_settings.layout_builder.enabled' => TRUE,
    ]);
    $layout_bundles = [];
    foreach ($displays as $display) {
        $bundle = $display->getTargetBundle();
        $layout_bundles[$display->getTargetEntityTypeId()][$bundle] = $bundle;
    }
    return $layout_bundles;
}

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