Problem/Motivation
When location_variant is enabled, there is a mismatch between the langcode that is used for the lookup of path aliases in AliasRepository::lookupBySystemPath() and the actual langcode stored in the path_alias table.
The stored langcode seems to be one coming from variants for Example en-0, whereas the langcode used for the lookup is the usual Drupal langcode, for instance “en”. So no alias is found during lookup and that’s causing path aliases not to work when location_variant is enabled.
Steps to reproduce
This is yet incomplete
Enable modules location_variant, pathauto
Configure variants
Add a pathauto pattern
Create a content
Proposed resolution
Override the AliasRepository service to add LocationHandler::DEFAULT_VARIATION_CODE as the first langcode to fall back to in addLanguageFallback() method. Also make sure the overridden service runs after the override of the workspaces module by increasing the module weight.
Issue fork variants-3331485
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
tim bozeman commentedI added the module weight part and committed it. Thank you!
🙌🏼
Comment #7
s_leu commentedCreated another PR that ensures that the invocation of location_variant's
hook_entity_updateandhook_entity_inserthappen before the ones of workspaces. I wasn't exactly sure about whether that's necessary forhook_entity_updatetoo, anyway it would be a minor change to remove that hook again.Comment #9
tim bozeman commentedThank you!