You are here

protected function BaseDependencyCollector::mergeDependencies in Dependency Calculation 8

Properly adds dependencies and their modules to a wrapper object.

Parameters

\Drupal\depcalc\DependentEntityWrapperInterface $wrapper: The object to add dependencies to.

\Drupal\depcalc\DependencyStack $stack: The stack with all loaded dependencies.

array $dependencies: The list of dependencies to add to the wrapper.

15 calls to BaseDependencyCollector::mergeDependencies()
DrupalMediaEmbedCollector::onCalculateDependencies in src/EventSubscriber/DependencyCollector/DrupalMediaEmbedCollector.php
Calculates media entities embedded into the text areas of other entities.
EmbeddedImagesCollector::addDependency in src/EventSubscriber/DependencyCollector/EmbeddedImagesCollector.php
Add dependency.
EntityEmbedCollector::extractEmbeddedEntities in src/EventSubscriber/DependencyCollector/EntityEmbedCollector.php
Extracts embedded entities from the text fields of another entity.
EntityFormDisplayDependencyCollector::onCalculateDependencies in src/EventSubscriber/DependencyCollector/EntityFormDisplayDependencyCollector.php
Calculates the associated entity form display.
EntityLanguage::onCalculateDependencies in src/EventSubscriber/DependencyCollector/EntityLanguage.php
Calculates the language of content entities.

... See full list

File

src/EventSubscriber/DependencyCollector/BaseDependencyCollector.php, line 24

Class

BaseDependencyCollector
An abstract class with helpful methods for all dependency collectors.

Namespace

Drupal\depcalc\EventSubscriber\DependencyCollector

Code

protected function mergeDependencies(DependentEntityWrapperInterface $wrapper, DependencyStack $stack, array $dependencies) {
  $modules = !empty($dependencies['module']) ? $dependencies['module'] : [];
  unset($dependencies['module']);
  $wrapper
    ->addDependencies($stack, ...array_values($dependencies));
  if ($modules) {
    $wrapper
      ->addModuleDependencies($modules);
  }
}