Loading src/EventSubscriber/QuizEventSubscriber.php +9 −8 Original line number Diff line number Diff line Loading @@ -17,17 +17,18 @@ class QuizEventSubscriber implements EventSubscriberInterface { } /** * If the current node is a course object, fulfill it for the current user. * Copy questions to a new quiz revision. * * @param ReplicateEntityEvent $event * @param AfterSaveEvent $event */ public function afterSave(AfterSaveEvent $event) { /* @var $quiz Quiz */ $quiz = $event->getEntity(); $entity = $event->getEntity(); if ($entity->getEntityTypeId() == 'quiz') { $old_quiz = Drupal::entityTypeManager() ->getStorage('quiz') ->loadRevision($quiz->old_vid); $quiz->copyFromRevision($old_quiz); ->loadRevision($entity->old_vid); $entity->copyFromRevision($old_quiz); } } } Loading
src/EventSubscriber/QuizEventSubscriber.php +9 −8 Original line number Diff line number Diff line Loading @@ -17,17 +17,18 @@ class QuizEventSubscriber implements EventSubscriberInterface { } /** * If the current node is a course object, fulfill it for the current user. * Copy questions to a new quiz revision. * * @param ReplicateEntityEvent $event * @param AfterSaveEvent $event */ public function afterSave(AfterSaveEvent $event) { /* @var $quiz Quiz */ $quiz = $event->getEntity(); $entity = $event->getEntity(); if ($entity->getEntityTypeId() == 'quiz') { $old_quiz = Drupal::entityTypeManager() ->getStorage('quiz') ->loadRevision($quiz->old_vid); $quiz->copyFromRevision($old_quiz); ->loadRevision($entity->old_vid); $entity->copyFromRevision($old_quiz); } } }