You are here

public function MyEventSubscriber::newRevision in Scheduled Transitions 8

Same name and namespace in other branches
  1. 2.x scheduled_transitions.api.php \MyEventSubscriber::newRevision()

Custom logic to determine new revision for a scheduled transition.

Parameters

\Drupal\scheduled_transitions\Event\ScheduledTransitionsNewRevisionEvent $event: New revision event.

File

./scheduled_transitions.api.php, line 35

Class

MyEventSubscriber
Event subscribers for Scheduled Transitions Field.

Code

public function newRevision(\Drupal\scheduled_transitions\Event\ScheduledTransitionsNewRevisionEvent $event) : void {
  $scheduledTransition = $event
    ->getScheduledTransition();
  $entity = $scheduledTransition
    ->getEntity();
  $newRevision = $entity;
  $event
    ->setNewRevision($newRevision);
  $event
    ->stopPropagation();
}