protected function QuizStorage::doPostSave in Quiz 8.6
Same name and namespace in other branches
- 8.5 src/Storage/QuizStorage.php \Drupal\quiz\Storage\QuizStorage::doPostSave()
- 6.x src/Storage/QuizStorage.php \Drupal\quiz\Storage\QuizStorage::doPostSave()
Performs post save entity processing.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The saved entity.
bool $update: Specifies whether the entity is being updated or created.
Overrides ContentEntityStorageBase::doPostSave
File
- src/
Storage/ QuizStorage.php, line 35
Class
Namespace
Drupal\quiz\StorageCode
protected function doPostSave(EntityInterface $entity, $update) {
/* @var $entity \Drupal\quiz\Entity\Quiz */
if (isset($entity->old_vid)) {
// Duplicate of quiz.
$old_vid = $entity->old_vid;
}
if (!$entity
->isNew() && $entity
->isNewRevision()) {
// New revision of quiz.
$old_vid = $entity
->getLoadedRevisionId();
}
if (isset($old_vid)) {
$original = \Drupal::entityTypeManager()
->getStorage('quiz')
->loadRevision($old_vid);
$entity
->copyFromRevision($original);
}
return parent::doPostSave($entity, $update);
}