You are here

protected function LayoutBuilderDependencyCollectorBase::addSectionComponentEntityDependencies in Dependency Calculation 8

Adds entity dependencies from this layout builder field to this event dependencies.

Parameters

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

\Drupal\Core\Entity\EntityInterface[] $entities: The entity dependencies.

Throws

\Exception

1 call to LayoutBuilderDependencyCollectorBase::addSectionComponentEntityDependencies()
LayoutBuilderDependencyCollectorBase::addComponentDependencies in src/EventSubscriber/LayoutBuilderComponentDepencyCollector/LayoutBuilderDependencyCollectorBase.php
Adds dependencies from components.

File

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

Class

LayoutBuilderDependencyCollectorBase

Namespace

Drupal\depcalc\EventSubscriber\LayoutBuilderComponentDepencyCollector

Code

protected function addSectionComponentEntityDependencies(CalculateEntityDependenciesEvent $event, array $entities) {
  foreach ($entities as $entity) {
    $item_entity_wrapper = new DependentEntityWrapper($entity);
    $local_dependencies = [];
    $this
      ->mergeDependencies($item_entity_wrapper, $event
      ->getStack(), $this
      ->getCalculator()
      ->calculateDependencies($item_entity_wrapper, $event
      ->getStack(), $local_dependencies));
    $event
      ->addDependency($item_entity_wrapper);
  }
}