- ๐บ๐ธUnited States kevinquillen
The patch applies under 2.0.0-alpha0 and Drupal 10.1.1, but I would argue this should be more generic. Instead, there should be an option to hide breadcrumbs if only 1 item (linked or not) is present. This is typically "Home" for most people I would assume, and single item breadcrumbs don't solve much purpose.
Could we just change this so it hides a single item, linked or not?
- ๐บ๐ธUnited States danflanagan8 St. Louis, US
Hi, @kevinquillen. The project I was using this patch on no longer uses menu_breadcrumb, so I no longer have any skin in the game. I haven't thought about this in a long time (March 2022!?!?) but I see a single unlinked breadcrumb as being particularly problematic.
However, in the few seconds since typing that, it occurs to me that it is unlikely that a single site would have scenarios with a single unlinked breadcrumb on some pages while having a single linked breadcrumb on other pages. A given site would would presumably experience a single breadcrumb as always being linked or always being unlinked. Therefore, I think you're right that a more general "hide single breadcrumb" setting would offer the most value.
I don't think I will personally update the patch, but you can feel free to re-purpose this issue for the more general "hide single breadcrumb" option.
Cheers!
- Open on Drupal.org โCore: 9.5.x + Environment: PHP 8.0 & MySQL 5.7last update
over 1 year ago Waiting for branch to pass - ๐บ๐ธUnited States kevinquillen
Here is an updated patch that hides the breadcrumb if it contains a single item, whether its linked or not.
- ๐บ๐ธUnited States dgroene
Because this analysis happens after Home is added (if that is selected), the presence of the home link makes the patch in #7 inapplicable to any page but the homepage. I tweaked the code to take into account if home has been added, so the breadcrumbs will only show if the total links are at least 3 (including HOME, self, and one other) or if home is not added, 2.
- First commit to issue fork.
- ๐ณ๐ฟNew Zealand xurizaemon ลtepoti, Aotearoa ๐
Attaching interdiff to show changes between previous two patches.
Let's switch to using Gitlab MRs over patches if you don't mind? ( Using Gitlab to contribute to Drupal โ .)
Let's also add this to the existing test coverage in tests/src/Functional/SettingsFormTest.php please.
- Status changed to Needs work
8 months ago 7:07pm 29 March 2024 - ๐ณ๐ฟNew Zealand xurizaemon ลtepoti, Aotearoa ๐
Thinking this might be better labelled as "Remove single items", to match the existing "Remove home" setting?
(I find that when I encounter a setting phrased negatively (eg "Do not add single item"), and I see that the setting is currently FALSE, I can hear clapper boards flipping in my head as I try to calculate that if-not-do-not-add means do or don't do X. This is likely a me problem, but I think it can improve both comms and DX generally to prefer positively phrased statements!)
- ๐ณ๐ฟNew Zealand xurizaemon ลtepoti, Aotearoa ๐
@dgroene I've added some additional tests which hopefully will help to clarify the expected behaviour. Please do continue working on this if you can!
Take a look at https://git.drupalcode.org/issue/menu_breadcrumb-3269452/-/blob/3269452-... (and other tests in that directory) to see a test which can cover this behaviour. I'm sure it can be improved, hoping to give you a good start point - let's not presume it's 100% correct please :)