- 🇨🇳China skyredwang Shanghai
The problem can be reproduced if the page to be translated has blocks which are not pointing to its latest revision.
I tested the patch, it fixed the problem, and the code makes sense to me. I have been thinking on writing a test against it. But, I haven't found a way to update an inline block outside the layout builder to create a new revision which is not referenced by the layout overrides. Maybe, there is another easy way to reproduce the problem on a fresh install?
- 🇨🇳China skyredwang Shanghai
I added one more line null safety check to handle the case that a revisioned reference in a block could be missing (possibily deleted)
/** @var \Drupal\Core\Entity\EntityInterface $reference */ /** @var \Drupal\Core\Entity\EntityInterface $reference_clone */ $reference = \Drupal::service('entity_type.manager')->getStorage($target_type)->loadRevision($value['target_revision_id']); if ($reference) { $reference_clone = $reference->createDuplicate(); $reference_clone->save(); $new_values[] = [ 'target_id' => $reference_clone->id(), 'target_revision_id' => $reference_clone->getRevisionId(), ]; }