Closed (fixed)
Project:
Views tree
Version:
7.x-2.0
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Feb 2013 at 07:23 UTC
Updated:
1 Mar 2013 at 23:20 UTC
Would it be possible to populate a views tree using relationships created using the relation module? If so, could you outline the process for doing so?
Thanks very much for the great module you've created.
Comments
Comment #1
kingswoodute commentedHi,
I've just answered my own question. It's perfectly easy to populate a views tree using the Relation module and the process is almost identical to the process used when using Entity Reference.
1) Create your view (make sure you are starting from the bottom level because you build the tree upwards) and start with just a list of fields (table or unformatted - it doesn't matter)
2) Add your relationships to the view (you will need to add a relationship [in the view - advanced options] from your bottom level node to the relation [built using the relation module] AND another relationship [in the view - advanced options] from the relation [relation module] to the node [being the next node on the hierarchy])
3) Add a node id for the base level node (don't use a relationship)
4) Add a node id for the next node up in the hierarchy (use a relationship for this one - the relation set up in the relation module) - call this one pnid (or parent node id)
5) hide the node ids from display
6) Change the display to Views Tree (Adjacency model) [Main field == nid, Parent field == Parent pnid]
7) Test it
Please let me know if this isn't clear and thanks again very much for this excellent module!
Comment #2
geerlingguy commentedThanks for documenting this! I've added your guide to the Views Tree documentation page.
Comment #3
kingswoodute commentedThanks very much.
But I think you've replaced the instructions for the Entity Reference module (http://drupal.org/project/entityreference) with my instructions which were for the relation module (http://drupal.org/project/relation).
I'm sorry about that I should have included a reference to the project in my original post.
I think people may get confused as the processes are different. Would it be possible to put back the instructions that were there before for the Entity Reference module and put my instructions under a separate heading for the Relation module?
Alternatively the instructions for the References module (at the bottom of the page) should work for the Entity Reference module as well.
Sorry about the confusion and have a great day.
Comment #4
geerlingguy commentedWhoops! I was doing too much at once; I'll fix that, and thanks again for detailing the process!
Comment #5
geerlingguy commentedI fixed the docs, and reopened #1719206: Test with Entity Reference, add to documentation/readme/project page.