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

Command icon 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

s_leu created an issue. See original summary.

Tim Bozeman made their first commit to this issue’s fork.

tim bozeman’s picture

Status: Active » Fixed

I added the module weight part and committed it. Thank you!

🙌🏼

s_leu’s picture

Status: Fixed » Needs review

Created another PR that ensures that the invocation of location_variant's hook_entity_update and hook_entity_insert happen before the ones of workspaces. I wasn't exactly sure about whether that's necessary for hook_entity_update too, anyway it would be a minor change to remove that hook again.

  • Tim Bozeman committed 443f8ea8 on 1.0.x authored by s_leu
    Issue #3331485: Invoke location_varian's hook_entity_insert and...
    
tim bozeman’s picture

Status: Needs review » Fixed

Thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.