protected function EmbeddedImagesCollector::addDependency in Dependency Calculation 8
Add dependency.
Parameters
\Drupal\depcalc\Event\CalculateEntityDependenciesEvent $event: Event.
\Drupal\Core\Entity\EntityInterface $entity: Entity.
Throws
\Exception
1 call to EmbeddedImagesCollector::addDependency()
- EmbeddedImagesCollector::onCalculateDependencies in src/
EventSubscriber/ DependencyCollector/ EmbeddedImagesCollector.php - Reacts on CALCULATE_DEPENDENCIES event.
File
- src/
EventSubscriber/ DependencyCollector/ EmbeddedImagesCollector.php, line 124
Class
- EmbeddedImagesCollector
- Class EmbeddedImagesCollector.
Namespace
Drupal\depcalc\EventSubscriber\DependencyCollectorCode
protected function addDependency(CalculateEntityDependenciesEvent $event, EntityInterface $entity) : void {
if ($event
->getStack()
->hasDependency($entity
->uuid())) {
return;
}
$entity_wrapper = new DependentEntityWrapper($entity);
$local_dependencies = [];
$entity_wrapper_dependencies = $this
->getCalculator()
->calculateDependencies($entity_wrapper, $event
->getStack(), $local_dependencies);
$this
->mergeDependencies($entity_wrapper, $event
->getStack(), $entity_wrapper_dependencies);
$event
->addDependency($entity_wrapper);
}