diff --git a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php index 75c82dbe8d..ef25d34b1c 100644 --- a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php +++ b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php @@ -174,6 +174,9 @@ protected function ensureLoaded() { if (!$this->isLoaded) { $entity = $this->getEntity(); if (!$entity->isNew()) { + // When there is a revisionable entity type and we're loading the + // non-default revision the alias might use the revision path or the + // canonical path. if ($entity->getEntityType()->isRevisionable() && !$entity->isDefaultRevision()) { $conditions = ['source' => [ '/' . $entity->toUrl('revision')->getInternalPath(), diff --git a/core/modules/path/tests/src/Functional/PathContentModerationTest.php b/core/modules/path/tests/src/Functional/PathContentModerationTest.php index 32fef3d3f0..05272c3475 100644 --- a/core/modules/path/tests/src/Functional/PathContentModerationTest.php +++ b/core/modules/path/tests/src/Functional/PathContentModerationTest.php @@ -39,6 +39,9 @@ protected function setUp() { $this->drupalLogin($this->rootUser); } + /** + * Tests node path aliases on a moderated content type. + */ public function testNodePathAlias() { // Create some moderated content with a path alias. $this->drupalGet('node/add/moderated');