class QuizEventSubscriber in Quiz 6.x
Same name and namespace in other branches
- 8.6 src/EventSubscriber/QuizEventSubscriber.php \Drupal\quiz\EventSubscriber\QuizEventSubscriber
- 8.5 src/EventSubscriber/QuizEventSubscriber.php \Drupal\quiz\EventSubscriber\QuizEventSubscriber
Hierarchy
- class \Drupal\quiz\EventSubscriber\QuizEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of QuizEventSubscriber
1 string reference to 'QuizEventSubscriber'
1 service uses QuizEventSubscriber
File
- src/
EventSubscriber/ QuizEventSubscriber.php, line 11
Namespace
Drupal\quiz\EventSubscriberView source
class QuizEventSubscriber implements EventSubscriberInterface {
public static function getSubscribedEvents() {
return [
'replicate__after_save' => [
'afterSave',
],
];
}
/**
* If the current node is a course object, fulfill it for the current user.
*
* @param ReplicateEntityEvent $event
*/
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);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
QuizEventSubscriber:: |
public | function | If the current node is a course object, fulfill it for the current user. | |
QuizEventSubscriber:: |
public static | function |