diff --git a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php index ef25d34b1c..625aa9c645 100644 --- a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php +++ b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php @@ -117,10 +117,11 @@ public function postSave($update) { /** @var \Drupal\Core\Path\AliasStorageInterface $alias_storage */ $alias_storage = \Drupal::service('path.alias_storage'); - // Only process a non-empty alias. + // When there is a revision link template and the entity is not the default + // revision use the revision url, otherwise use the canonical url. $entity = $this->getEntity(); $canonical = '/' . $entity->toUrl()->getInternalPath(); - if ($entity->getEntityType()->isRevisionable() && !$entity->isDefaultRevision()) { + if ($entity->getEntityType()->hasLinkTemplate('revision') && !$entity->isDefaultRevision()) { $source = '/' . $entity->toUrl('revision')->getInternalPath(); } else { @@ -174,10 +175,10 @@ 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 + // When the entity type has a revision link template 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()) { + if ($entity->getEntityType()->hasLinkTemplate('revision') && !$entity->isDefaultRevision()) { $conditions = ['source' => [ '/' . $entity->toUrl('revision')->getInternalPath(), '/' . $entity->toUrl()->getInternalPath(),