X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fpath%2Fsrc%2FPlugin%2FValidation%2FConstraint%2FPathAliasConstraintValidator.php;h=be6350f75b24866cb8fcd01b44ec80a6772c77dd;hp=e6771f76d2fab7d0e2875f407811a4af52f27aa3;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hpb=9424afc6c1f518c301bf87a23c047d1873435d05 diff --git a/web/core/modules/path/src/Plugin/Validation/Constraint/PathAliasConstraintValidator.php b/web/core/modules/path/src/Plugin/Validation/Constraint/PathAliasConstraintValidator.php index e6771f76d..be6350f75 100644 --- a/web/core/modules/path/src/Plugin/Validation/Constraint/PathAliasConstraintValidator.php +++ b/web/core/modules/path/src/Plugin/Validation/Constraint/PathAliasConstraintValidator.php @@ -48,8 +48,14 @@ class PathAliasConstraintValidator extends ConstraintValidator implements Contai if ($entity && !$entity->isNew() && !$entity->isDefaultRevision()) { /** @var \Drupal\Core\Entity\ContentEntityInterface $original */ $original = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->loadUnchanged($entity->id()); - if ($value->alias != $original->path->alias) { - $this->context->addViolation($constraint->message); + $entity_langcode = $entity->language()->getId(); + + // Only add the violation if the current translation does not have the + // same path alias. + if ($original->hasTranslation($entity_langcode)) { + if ($value->alias != $original->getTranslation($entity_langcode)->path->alias) { + $this->context->addViolation($constraint->message); + } } } }