Path matching does not work for translated paths.

Created on 2 December 2021, about 3 years ago
Updated 28 November 2024, 23 days ago

Problem/Motivation

There are a couple issues related to this:
#3198831: Path breadcrumbs with Views page URL don't work on node pages if language not selected - active, and less obviously this issue
#3212419: Path breadcrumbs does not work with URL alias as pattern if language is not specified - closed, but pretty sure it doesn't work.

Neither of these patches could work as they don't take the language of either the current page or crumb pattern into account.

When i first looked at this i was trying to use the prefixed path rather than Url::fromRouteMatch($route_match) (as it doesn't include the prefix); but then remembered that just because my site setup uses path prefix; that doesn't mean all sites use this to determine the current page's language. So i changed my thinking to simply get the (content) language of the current page (set regardless of how this is set for a site) and if this language doesn't match the pattern's lang setting; simply ignore it.

That last part is the main reason the previous patches weren't working as they are matching against lang independent paths and then match on first match whether or not it the pattern applies to that language.

Also, i specifically look up the current page's Content language as I am pretty sure breadcrumbs are Content. This module considers them as Interface. I have another patch posted a few days ago which fixes that - but if someone strongly feels that breadcrumbs are Interface; then the patch here won't work correctly.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

1.0

Component

custom_breadcrumbs_paths

Created by

🇨🇦Canada liquidcms

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

Merge Requests

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