You are here

protected function LayoutEntityHelperTrait::getInlineBlockComponents in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/LayoutEntityHelperTrait.php \Drupal\layout_builder\LayoutEntityHelperTrait::getInlineBlockComponents()
  2. 9 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.

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;
}