You are here

private function ImportEntityManager::findRootAncestorImportEntity in Acquia Content Hub 8

Returns the entity's root ancestor's imported entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The current (child) entity.

Return value

\Drupal\acquia_contenthub\ContentHubEntitiesTracking|bool The root ancestor's ContentHubEntitiesTracking object.

1 call to ImportEntityManager::findRootAncestorImportEntity()
ImportEntityManager::entityPresave in src/ImportEntityManager.php
Act on the entity's presave action.

File

src/ImportEntityManager.php, line 923

Class

ImportEntityManager
Provides a service for managing imported entities' actions.

Namespace

Drupal\acquia_contenthub

Code

private function findRootAncestorImportEntity(EntityInterface $entity) {
  $imported_entity = $this->contentHubEntitiesTracking
    ->loadImportedByDrupalEntity($entity
    ->getEntityTypeId(), $entity
    ->id());
  if (!$imported_entity || !$imported_entity
    ->isDependent()) {
    return $imported_entity;
  }
  return $this
    ->findRootAncestorImportEntity($this
    ->getParentEntity($entity));
}