You are here

function lightning_scheduler_entity_presave in Lightning Workflow 8.2

Same name and namespace in other branches
  1. 8.3 modules/lightning_scheduler/lightning_scheduler.module \lightning_scheduler_entity_presave()
  2. 8 modules/lightning_scheduler/lightning_scheduler.module \lightning_scheduler_entity_presave()

Implements hook_entity_presave().

File

modules/lightning_scheduler/lightning_scheduler.module, line 141

Code

function lightning_scheduler_entity_presave($entity) {

  // This is a horrible hack to work around Content Moderation's opinions being
  // a little too strong. See lightning_scheduler_update_8001().
  if ($entity instanceof ContentEntityInterface && isset($entity->existingRevisionId)) {
    $entity
      ->setNewRevision(FALSE);
    $entity
      ->set($entity
      ->getEntityType()
      ->getKey('revision'), $entity->existingRevisionId);
    unset($entity->existingRevisionId);
  }
}