You are here

public function QuizEventSubscriber::afterSave in Quiz 6.x

Same name and namespace in other branches
  1. 8.6 src/EventSubscriber/QuizEventSubscriber.php \Drupal\quiz\EventSubscriber\QuizEventSubscriber::afterSave()
  2. 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

QuizEventSubscriber

Namespace

Drupal\quiz\EventSubscriber

Code

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);
}