You are here

protected function LayoutEntityHelperTrait::getInlineBlockComponents in Drupal 9

Same name and namespace in other branches
  1. 8 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;
}