In a node template panel ('node/%node'), I needed a way to pass all terms of that node (concatenated) as an argument to a view. I ended up creating a new ctools relationship plugin, heavily based on term_from_node.inc. The patch just adds one new file, all_terms_from_node.inc. As far as I can see, it works fine with Ctools version 1.3 relased last week.

I'm not 100% sure if my approach is optimal...
1) The choice for the concatenator (',' or '+') is now made on the relationship settings form, but I think it would be more flexible if this choice can be made per view, in the view settings modal dialog.
2) Perhaps it would be better to integrate this with term_from_node instead of creating a new plugin?

I'm looking forward to your reviews and comments.

Comments

marcvangend’s picture

StatusFileSize
new2.77 KB

Strange, my attachment wasn't added. Try again.
[edit: yeah, that's better!]

merlinofchaos’s picture

One quick comment from review: One vid seems limiting. Can we make vocabulary be multi-select?

marcvangend’s picture

StatusFileSize
new2.73 KB

You're right, the single vocab was a left-over from term_from_node.inc, but too limiting for this one. Here's a second version.

tayzlor’s picture

StatusFileSize
new2.91 KB

i was halfway through writing this myself when i came and found this. brilliant, cheers.
Tested this on my local instance and it does indeed work.

One suggestion, can i suggest renaming it from all_terms_from_node to simply 'terms_from_node' since it may not actually be all, but simply a selection. I think this would be less confusing.

re-attaching a patch to cover this if you think its sensible, if not ignore and take previous patch.

marcvangend’s picture

Tayzlor, thanks for your testing and feedback.

I'm not sure about 'terms_from_node' because I think it would actually be more confusing because the difference with 'term_from_node' is only one character. The name all_terms_from_node was inspired by the Views field called "Taxonomy: All terms" (which, by the way, can also be narrowed down to certain vocabs). I am interested in other people's opinions though.

merlinofchaos’s picture

I am for 'terms_from_node' as the actual name, and possibly the friendly name being "Multiple terms from node" to make it clear that it's a terms context, not a term.

marcvangend’s picture

StatusFileSize
new2.83 KB

OK, 'terms_from_node' it is.

One thought comes up: When reading "Multiple terms from node", would some users expect a more fine-grained control than the per-vocabulary settings that this patch currently offers? Well, when they do, they're welcome to write a patch and extend the plugin :-)

Here is a new patch with the friendly name "Multiple terms from node" in it.

awebb’s picture

This patch works for me. I have traced through it and it returns expected results. Thanks for the great work!

Any chance we could get this rolled into the next release?

merlinofchaos’s picture

Version: 6.x-1.3 » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

Committed to 6.x branch with a minor typo fix. Needs to get into 7.x as well.

merlinofchaos’s picture

Status: Patch (to be ported) » Closed (fixed)

All of the 'to be ported' patches got merged in during the porting sprint in September.