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?

CommentFileSizeAuthor
#2 Capture.PNG30.98 KBbomarmonk

Comments

donquixote’s picture

Priority: Critical » Normal

[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?

bomarmonk’s picture

Priority: Normal » Critical
StatusFileSize
new30.98 KB

Yes: 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").

donquixote’s picture

issue-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

bomarmonk’s picture

The 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."

bomarmonk’s picture

Either way, at this point, nothing is added to the breadcrumb. It just lists "Home->Currently viewed node title."

bomarmonk’s picture

It 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."

donquixote’s picture

Priority: Critical » Normal

Yes, 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.

bomarmonk’s picture

Priority: Normal » Critical

Thanks 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.

donquixote’s picture

Priority: Critical » Normal

This works for me:
[node:field-test-ref-node-eb:0:url]

bomarmonk’s picture

Status: Active » Fixed

Bingo: 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.

donquixote’s picture

Hm, 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 :)

donquixote’s picture

And yes, you can let the backreference maintainer know about this stuff.

bomarmonk’s picture

I 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.

donquixote’s picture

Wow. 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.

donquixote’s picture

#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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.