You are here

function entity_hierarchy_entity_update in Entity Reference Hierarchy 8.2

Same name and namespace in other branches
  1. 3.x entity_hierarchy.module \entity_hierarchy_entity_update()

Implements hook_entity_update().

File

./entity_hierarchy.module, line 68
A module to make entities hierarchical.

Code

function entity_hierarchy_entity_update(EntityInterface $entity) {
  if (!$entity instanceof ContentEntityInterface) {
    return;
  }
  if (isset($entity->original)) {
    \Drupal::service('class_resolver')
      ->getInstanceFromDefinition(ParentEntityRevisionUpdater::class)
      ->moveChildren($entity->original, $entity);
  }
}