Make location_variant work with path_alias

Created on 6 January 2023, over 2 years ago
Updated 19 January 2023, over 2 years ago

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.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024