I have a view with two contextual filters and three pages (examples, examples/% and examples/%/%)
Suppose the current path is examples/3. In the breadcrumb trail I expect to see:
<a href="/">Home</a> >> <a href="/examples">Examples</a>
What I actually see is
<a href="/">Home</a> >> <a href="/examples/all">Examples</a>
This is a problem, because clicking on this "Examples" breadcrumb link then takes me to the same page of the view (examples/%) rather than examples, as I want.
I have tried setting the "Skip default argument for view URL" option for both contextual filters, but this doesn't work.
From my point of view this is a bug, but perhaps it is inentional behaviour, and there is another way of achieving the desired effect.
If it is a bug, I'd be happy to share such insights as I have gleaned from looking at the code in includes/view.inc (_build_argments() and get_url()). However, experience has taught me that my insights into views are rather limited!
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | contextual_filter_exception_breadcrumbs-1201160-21.patch | 621 bytes | pacproduct |
| #18 | views-contextual_filter_exception_breadcrumbs-1201160-18.patch | 621 bytes | chris burge |
| #17 | views-contextual_filter_exception_breadcrumbs-1201160-17.patch | 977 bytes | hlopes |
| #8 | empty-breadcumbs.patch | 581 bytes | omerida |
| #3 | view.txt | 6.56 KB | manuel garcia |
Comments
Comment #1
dawehnerIt would be good if you could provide an export of the view, so it can be reproduced very easy.
Comment #2
esmerel commentedComment #3
manuel garcia commentedPlease feel free to flame me if I should've opened a new issue :X
Here is my situation (find attached the view):
The view shows the images paginated that are inside a multivalue field, in a node:
Path:
node/%/imagenesDisplaying: 1 image field, one value per row
Argument:
This results in a breadcrumb entry is inserted pointing to
node/all/images, which shows the view with no results.Idealy (at least in my case) would be to have the breadcrumb point to node/% having the title of the node.
Comment #4
manuel garcia commentedI've also tested removing the argument 'Exception value'
all. This results in the breadcrumb link pointing tonode/*/imagenesComment #5
ludo.rI'm having the same issue.
I have a view that uses 2 arguments as "Term ID from URL".
The view is in the menu.
The view keeps adding the "all" link within breadcrumb.
E.g. :
- Home
- Term1 [Home -> Term1 -> Vocabulary1_name(/all)]
-- Term2 [Home -> Term1 -> Term2 -> Vocabulary1_name(/all) -> Vocabulary2_name(/all/all)]
-- Term3 [Home -> Term1 -> Term3 -> Vocabulary1_name(/all) -> Vocabulary2_name(/all/all)]
I don't want the breadcrumb to show the vocabulary names with wildcards links.
Comment #6
bancarddata commentedA couple of ideas to possibly help with this problem are given at #1345852: Override the views breadcrumb path
Comment #7
jmking commentedJust ran into this problem myself.
If you dig around in the Views code long enough, you'll find
views_handler_argument::uses_breadrumb()function in handlers/views_handler_argument.inc.Then it checks in
views_handler_argument::default_actions()- and you can seebreadcrumb => TRUEunder summary, empty, not found, default, and ignore.The troublesome code seems to be in
view::_build_arguments()in includes/view.inc around line 840:This code probably shouldn't run if the contextual filter isn't set to override the breadcrumb, but it does anyway.
As OP probably also found - get_url is receiving an empty $breadcrumb_args, which is causing it to fall down to the default actions, and then when
view::get_breadcrumb()is called, it array_merges the Views generated breadcrumb with the Drupal generated breadcrumb which is causing the breadcrumb to output something like Home (/) > Example (/example/all) > Example (/example/5).This is just a brain dump of what I've figured out so far. I think there probably IS a bug here, but it's difficult to tell whether or not this is working as designed or not.
Comment #8
omerida commented@jmking following what you started, if you provide a default value for an argument, then uses_breadcrumb() for the argument handler returns true. Attached patch will tell arguments to ignore the breadcrumb if the exception value is empty
Comment #9
chris burge commented#8 is exactly what I needed.
Comment #10
hlopes commentedLets try to get this into dev.
Comment #11
hlopes commentedComment #12
anouWorks for me and is the logical way I think: "empty value" == "empty breadcrumb" which means in french: "If there is no value, I want no exception"
Thanks for this patch.
Comment #13
hlopes commentedComment #14
colanWhat's the difference between #8 and #10? Either way, capitalization and punctuation are missing from the comment.
Comment #15
hlopes commentedThere's no difference, just was trying to requeue to see if the test would go through.
Comment #16
colanUnfortunately, not until #2450447: Drupal QA is broken for Views 7.x-3.x gets fixed.
Comment #17
hlopes commentedJust changing the patch name to match drupal.org standards in accordance to https://www.drupal.org/node/707484
Comment #18
chris burge commentedRe-rolled against HEAD
Comment #20
chris burge commentedIt looks like something with tests is broken. I reviewed the console output and all tests pass. The failure appears to be unrelated to this patch. Re-setting to Needs Review.
Comment #21
pacproduct commentedRe-rolled against HEAD.