Breadcrumb link title for the current page should be taken from the matched menu item

Created on 17 November 2021, about 3 years ago
Updated 29 March 2024, 8 months ago

Problem/Motivation

Sometimes, the title of the current page is different from the menu link title - so, if the current page is found in a menu, the breadcrumb link title could be taken from the menu item.

Steps to reproduce

(Detailed instructions on how to reproduce the issue, including exact versions used, specific paths to visit, what actions to take, etc.)

Proposed resolution

Permit breadcrumb builder to be configured to obtain link title from menu entry.

Remaining tasks

  • Complete this issue description
  • Review whether this is the correct place to apply the change - are there other modules which could be used to provide this specific functionality?
  • Make the proposed behaviour configurable
  • Add test coverage

User interface changes

  • New setting on Menu Breadcrumb administration page
  • Changes to behaviour when populating breadcrumb - if enabled, will use menu link text not content title

API changes

?

Data model changes

  • New setting added to config schema and module defaults

Release notes snippet

(Major and critical issues should have a snippet that can be pulled into the release notes when a release is created that includes the fix)

✨ Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡·πŸ‡΄Romania adinac

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.

  • πŸ‡³πŸ‡ΏNew Zealand xurizaemon Ōtepoti, Aotearoa 🏝
  • πŸ‡ΊπŸ‡ΈUnited States dgroene

    I think this should do it... I think we need to add the item to the links before breaking out of the loop, as addMissingCurrentPage(), which adds the link using the node title, is expecting the link to already be in the $links array.

  • πŸ‡ΊπŸ‡ΈUnited States dgroene

    Please disregard my prior comment/patch... this is just moving the link add above where we break on first url match.

  • πŸ‡ΊπŸ‡ΈUnited States dgroene
  • πŸ‡³πŸ‡ΏNew Zealand xurizaemon Ōtepoti, Aotearoa 🏝

    Thanks for the patches!

    We can consider this if the changed behaviour is opt-in. The existing patch looks like it implements the change you desire, but that would affect all sites using the module, and this won't be what many other sites using the module would anticipate or desire.

    If implemented, this will need both a config option to enable the new behaviour, and the default behaviour should be the current behaviour. There should also be test coverage, which I can assist with.

    I have updated the issue description with some more complete details and remaining tasks.

    On the next code submission to this issue, let's please switch to using a merge request? (That's a request, patches are still welcome of course but MRs are preferred for collaboration and community process.)

Production build 0.71.5 2024