I have a view page, that works as an image gallery to each node of my project.
The path is node/%/gallery, where % is the node id.
The argument is the node reference field of the image content type with the nid in the url as a default argument.
So, i needed to created a custom breadcrumb to each gallery with the title of the node.
First i created two custom tokens, token_custom_node_title to get the title of the node, using the nid in the url. And token_custom_nid to get the nid in the url.
token_custom_node_title:
$nodeLoad = node_load(arg(1));
return $nodeLoad->title;
token_custom_nid:
return arg(1);
Later i created the custom breadcrumb with this settings:
Titles:
[token_custom_node_title]
Paths:
node/[token_custom_nid]
The result: is working like a charm, except in empty views, where the tokens aren't replaced, because the custom_breadcrumbs_views.module requires that views have at least one result to use his values to replace tokens. But in the case that i'm describing, it doesn't make sense, since i need the values that are in the nid in url and not the views results values. Moreover, since every node of my project have a gallery, not all galleries will have images, but all galleries need a custom breadcrumb.
I found various issues related to this, but not with the same need/behaviour.
#680026: Custom Breadcrumbs doesn't work if view is provided a default argument
#954550: In views path node/%/?? using $view->args[0]
#1117712: Tokens do not get replaced when view returns an empty set.
#955880: placeholder tokens problem
So, i think that this module needs a workaround to replace tokens even if the view don't have results, since not always the users need the view results values.
Thank you very much for this module!
Edit:
The tokens are replaced if the argument is Node: Nid, but not if the argument is a Node Reference field.
Comments
Comment #0.0
brunorios1 CreditAttribution: brunorios1 commentedAdded more info
Comment #1
lamp5