public function QuizEventSubscriber::afterSave in Quiz 6.x
Same name and namespace in other branches
- 8.6 src/EventSubscriber/QuizEventSubscriber.php \Drupal\quiz\EventSubscriber\QuizEventSubscriber::afterSave()
- 8.5 src/EventSubscriber/QuizEventSubscriber.php \Drupal\quiz\EventSubscriber\QuizEventSubscriber::afterSave()
If the current node is a course object, fulfill it for the current user.
Parameters
ReplicateEntityEvent $event:
File
- src/
EventSubscriber/ QuizEventSubscriber.php, line 24
Class
Namespace
Drupal\quiz\EventSubscriberCode
public function afterSave(AfterSaveEvent $event) {
/* @var $quiz Quiz */
$quiz = $event
->getEntity();
$old_quiz = Drupal::entityTypeManager()
->getStorage('quiz')
->loadRevision($quiz->old_vid);
$quiz
->copyFromRevision($old_quiz);
}