function LayoutEntityHelperTrait::getInlineBlockComponents

Same name in other branches
  1. 8.9.x core/modules/layout_builder/src/LayoutEntityHelperTrait.php \Drupal\layout_builder\LayoutEntityHelperTrait::getInlineBlockComponents()
  2. 10 core/modules/layout_builder/src/LayoutEntityHelperTrait.php \Drupal\layout_builder\LayoutEntityHelperTrait::getInlineBlockComponents()
  3. 11.x core/modules/layout_builder/src/LayoutEntityHelperTrait.php \Drupal\layout_builder\LayoutEntityHelperTrait::getInlineBlockComponents()

Gets components that have Inline Block plugins.

Parameters

\Drupal\layout_builder\Section[] $sections: The layout sections.

Return value

\Drupal\layout_builder\SectionComponent[] The components that contain Inline Block plugins.

2 calls to LayoutEntityHelperTrait::getInlineBlockComponents()
InlineBlockEntityOperations::handlePreSave in core/modules/layout_builder/src/InlineBlockEntityOperations.php
Handles saving a parent entity.
LayoutEntityHelperTrait::getInlineBlockRevisionIdsInSections in core/modules/layout_builder/src/LayoutEntityHelperTrait.php
Gets revision IDs for layout sections.

File

core/modules/layout_builder/src/LayoutEntityHelperTrait.php, line 83

Class

LayoutEntityHelperTrait
Methods to help with entities using the layout builder.

Namespace

Drupal\layout_builder

Code

protected function getInlineBlockComponents(array $sections) {
    $inline_block_components = [];
    foreach ($sections as $section) {
        foreach ($section->getComponents() as $component) {
            $plugin = $component->getPlugin();
            if ($plugin instanceof DerivativeInspectionInterface && $plugin->getBaseId() === 'inline_block') {
                $inline_block_components[] = $component;
            }
        }
    }
    return $inline_block_components;
}

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