I've installed "Crumbs" and the "Backreference Entity" sandbox module (found here: http://drupal.org/sandbox/jsacksick/1301456). I see that I now have backreference tokens in my replacement patterns for breadcrumbs and for pathauto patterns, etc..
I have two node types: journal and article. The journal node has an entity reference field that references multiple articles. When viewing an article, I want to have the breadcrumb display the the title of the journal node that references that article. So my breadcrumb would be "Home->Issue 1-> Article 1" (for example).
When using the "Crumbs" module to show this, I see a token for "Backward reference to node via field_article_in_issue," but I'm not sure how to use this token to display that referencing node's (journal's) title. When I put the token for "Backward reference to node via field_article_in_issue" ([node:field-article-in-issue-eb] into the "node parent" pattern for my article content type, it doesn't have any effect on the breadcrumb when viewing articles.
I've added the above to the crumb's setting page so that the top (enabled section) looks like this:
crumbs.nodeParent.article
crumbs.home_title - Set "Home" as the title for the root item.
*
---- disabled ----
Any suggestions? I think this should work (it is working for my alias or pathauot url), but at this point, it doesn't work for breadcrumbs. I must be missing something. What's wrong with my configuration?
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | Capture.PNG | 30.98 KB | bomarmonk |
Comments
Comment #1
donquixote commented[node:field-article-in-issue-eb]
is this all you put into the "node parent" field for article content type?
Will this resolve to a path? Or just the nid?
Can you go to the "debug" page (admin/structure/crumbs/debug), type the path of an article node, and see what happens?
Comment #2
bomarmonk commentedYes: it looks like things are working on the debug screen, so maybe I'm not properly enabling the breadcrumb somehow? See my screenshot of the debug results (note: I changed the "article" type to "poem").
Comment #3
donquixote commentedissue-1-fall-amp-winter-2012
is this a complete alias?
if you type that in the address bar, e.g.
mysite.com/issue-1-fall-amp-winter-2012
Comment #4
bomarmonk commentedThe complete path alias, that goes to the referencing node or journal issue, is "mysite.com/issues/issue-1-fall-winter-2012/." It looks like the path on the debug page properly returns: "issues/issue-1-fall-winter-2012/last-home," but the parent path candidate is "issue-1-fall-amp-winter-2012."
Comment #5
bomarmonk commentedEither way, at this point, nothing is added to the breadcrumb. It just lists "Home->Currently viewed node title."
Comment #6
bomarmonk commentedIt actually looks like the "path candidate" is a cleaned up (transformed ampersand) version of the actual title of the referencing node: "Issue 1, Fall & Winter 2012."
Comment #7
donquixote commentedYes, and I can tell you why :)
"issue-1-fall-amp-winter-2012" is not a valid path or alias. So Crumbs just sends you to the homepage instead.
The best solution would be if you can somehow retrieve the nid of the journal node with a token, and then in the "node parent" you write
Article:
node/[node:field-article-in-issue-eb:nid]Disclaimer: I have no idea if this is a valid token. If you can't figure that out, please paste the available tokens - all that are related to backreference entity module.
---
Btw, I don't think this is critical :)
Critical is if a significant number of people have a serious problem.
Comment #8
bomarmonk commentedThanks for the quick response here.
You are probably right about the "critical" aspect of this issue (it was critical to me at least (lol), but the "use case" seems like a potentially common one).
As for the available tokens for the backreference, they are:
Backward reference to node via field_poem_in_issue [node:field-poem-in-issue-eb] Backward reference to node related. via field_poem_in_issue (and then under this larger heading)
Nodes with delta 1 [node:field-poem-in-issue-eb:1] The list item with delta 1. Delta values start from 0 and are incremented by one per list item.
Nodes with delta 2 [node:field-poem-in-issue-eb:2] The list item with delta 2. Delta values start from 0 and are incremented by one per list item.
Nodes with delta 3 [node:field-poem-in-issue-eb:3] The list item with delta 3. Delta values start from 0 and are incremented by one per list item.
Comment #9
donquixote commentedThis works for me:
[node:field-test-ref-node-eb:0:url]
Comment #10
bomarmonk commentedBingo: after enabling the "path" crumb, this worked beautifully! Awesome! Thanks again for your help! Maybe I can file an issue with the backreference module to make this even easier to configure with a token, but in the meantime, I'm a happy camper.
Thanks again! You helped me avoid potentially hours of head-scratching inefficiency.
Comment #11
donquixote commentedHm, I think we are mixing things up :)
The "path" crumbs rule probably achieves exactly what you want, but in a different way than you were originally planning. This only works because the paths for journals and articles kinda match up.
It would be interesting to see if it also works without the path rule, only with crumbs.nodeParent.article configured the way I mentioned.
After opening this issue, you owe the community to investigate this to the end :)
Comment #12
donquixote commentedAnd yes, you can let the backreference maintainer know about this stuff.
Comment #13
bomarmonk commentedI filed an issue for backreference entities here: http://drupal.org/node/1887838
Also, without the path crumbs enabled, the debug for your solution showed me the need for path to be enabled (the reason why I enabled it and happily discovered the token pattern now worked). Without the path crumbs enabled, the token pattern, [node:field-poem-in-issue-eb:0:url], did not generate a breadcrumb for the referenced entities.
Comment #14
donquixote commentedWow. This reveals a bug!
If the token string does not resolve to a valid path, it should return NULL, and not an unresolved token string.
I could reopen this in a new issue, but I think I just fix it instead.
Comment #15
donquixote commented#1887852: crumbs.nodeParent.* plugin returns unresolved tokens
opened and fixed.
Still this does not tell us whether the resolved token string is a valid path. This needs to be a follow-up.
Comment #16
donquixote commentedFollow-up:
#1887858: Plugins may return invalid paths. (especially crumbs.nodeParent.*)