Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi there,
I just noticed that when I outline a page under a book, it loses it´s menu breadcrumb, and uses the book one.
Is there any option to avoid that? Thanks in advance, Simon.
Comment | File | Size | Author |
---|---|---|---|
#5 | menu_breadcrumb.patch | 2.18 KB | Johnny vd Laar |
Comments
Comment #1
starkos CreditAttribution: starkos commented+1. It also doesn't work for forum containers.
Here's my use case (which worked OTB on 5.x grrr...): I have several product pages. Each product has documentation (a book) and discussions (a forum container). I set up my menu like this:
When I drill down into a child page of the book, I would expect the breadcrumb to read: Home > ProjectOne > Documentation. That is, from a child page I can return the top of the book, or the associated project. If I drill down farther into the book, I'd expect the breadcrumb to grow to include all parent pages, without losing the association to the root product page. What I get now is Home > Documentation.
When I drill down into a forum, I'd expect Home > ProjectOne > Discussion. What I get is Home > Forums > Discussion.
This seems like a bug in core, since the documentation indicates that the breadcrumb should reflect the Navigation menu. But I've spent hours reading all the discussions surrounding breadcrumbs and don't expect them to sort it anytime soon.
I'm working on a custom-coded breadcrumb as a workaround; when I get it working I'll post it here on the off-chance it'll help someone out.
Comment #2
starkos CreditAttribution: starkos commentedI managed to get breadcrumbs working with a menu in a way that seems intuitive. It supports books and forums, and should support any other content type. It is self-contained in a module, and does not require any template changes. But it is a real hack. I don't know if this is the right approach for the Menu Breadcrumb module -- I'd like to believe there is a better way -- but I present it on the off-chance it will help someone out.
Comment #3
starkos CreditAttribution: starkos commentedA small but important fix: convert path aliases to system URIs before trying to locate a matching menu item.
Comment #4
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedan easier solution is to add this in the menu_breadcrumbs module:
downside is that the menu_breadcrumb_init() function is called twice now. but it's because of the forum module that overrides the breadcrumb in the template_breadcrumb_preprocess_forums function in the forum module that this is needed.
i didn't test this approach for the books module but i assume the problem will be solved by adding this:
but someone who actually uses the book module should test this to be sure! ;)
ofcourse you can also place this in a seperate module (you'll have to rename the function then to mycustommodule_preprocess_forums)
Comment #5
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedok it turns out that my previous approach didn't really work perfect. this new approach (in the patch) has a static variable which solves all problems for me
Comment #6
joep.hendrix CreditAttribution: joep.hendrix commented#5 does not work here.
Comment #7
Johnny vd Laar CreditAttribution: Johnny vd Laar commenteddid you clear your drupal cache after applying the patch?
as it works for me for the forums
Comment #8
OldAccount CreditAttribution: OldAccount commentedNo luck with #5 either. :-(
Comment #9
jweowu CreditAttribution: jweowu commentedFWIW, #595282: Menu weights provides a solution to this.
Comment #10
xurizaemon#595282: Menu weights will resolve this issue, and is available in CVS and the upcoming -dev tarball.
I'm unsure if I should mark this as a duplicate of that ticket - but I'm going to, because the fix is in CVS already, and will be available for you to test via the 6.x-1.x-dev tarball in a few hours.
Please re-open this (long-standing) issue if that doesn't resolve things for you. If it does, please report as much on #595282: Menu weights.