You are here

protected function LayoutBuilderDependencyCollectorBase::addComponentDependencies in Dependency Calculation 8

Adds dependencies from components.

Parameters

\Drupal\depcalc\Event\CalculateEntityDependenciesEvent $event: The calculate entity dependencies event.

\Drupal\layout_builder\SectionComponent[] $components: The components for this field.

Throws

\Exception

2 calls to LayoutBuilderDependencyCollectorBase::addComponentDependencies()
LayoutBuilderEntityViewDisplayDependencyCollector::onCalculateDependencies in src/EventSubscriber/DependencyCollector/LayoutBuilderEntityViewDisplayDependencyCollector.php
Calculates the entities referenced in Layout Builder components.
LayoutBuilderFieldDependencyCollector::onCalculateDependencies in src/EventSubscriber/DependencyCollector/LayoutBuilderFieldDependencyCollector.php
Calculates the entities referenced on Layout Builder components.

File

src/EventSubscriber/LayoutBuilderComponentDepencyCollector/LayoutBuilderDependencyCollectorBase.php, line 69

Class

LayoutBuilderDependencyCollectorBase

Namespace

Drupal\depcalc\EventSubscriber\LayoutBuilderComponentDepencyCollector

Code

protected function addComponentDependencies(CalculateEntityDependenciesEvent $event, array $components) {
  foreach ($components as $component) {
    $componentEvent = new SectionComponentDependenciesEvent($component);
    $this->dispatcher
      ->dispatch(DependencyCalculatorEvents::SECTION_COMPONENT_DEPENDENCIES_EVENT, $componentEvent);
    $this
      ->addSectionComponentEntityDependencies($event, $componentEvent
      ->getEntityDependencies());
    $event
      ->setModuleDependencies($componentEvent
      ->getModuleDependencies());
  }
}