Node references - the module node relationships
I often have the problem to visualize relationships between nodes. Sometimes I use blocks in views with parameters, sometimes I embed views in node templates and so on. Another problem is often the kind of relationship between nodes. Sometimes they have a relationship vice versa, sometimes not. But I don't want to bother you with these things ...
The reason why I am writing this entry is, that I have found a good module helping me to get my job done: noderelationships.
The Task: Who is doing what with whom?
We have three actors: persons, partners and projects
We want to have a website with a few relationships
I often have the problem to visualize relationships between nodes. Sometimes I use blocks in views with parameters, sometimes I embed views in node templates and so on. Another problem is often the kind of relationship between nodes. Sometimes they have a relationship vice versa, sometimes not. But I don't want to bother you with these things ...
The reason why I am writing this entry is, that I have found a good module helping me to get my job done: noderelationships.
The Task: Who is doing what with whom?
We have three actors: persons, partners and projects
We want to have a website with a few relationships
A person:
- is involved in one or many projects
- works for one or many partners
A partner (usually a company or an NGO):
- is involved in one or many projects
A project
- has one partner as the lead partner
- has one person as project coordinator
We need listviews of:
- persons
- projects
- partners
We need pageviews for
every person
- name
- involved in project a,b, c
- works for partner d,e,f
- project coordinator in project a, b, c
every partner
- name
- employs persons a, b, c
- involved in project a, b, c
- lead partner in project a, b, c
every project
- name
- leadpartner
- project coordinator
- partner
- persons
Here is an idea for a solution using the module noderelationships
Beside the noderelationships module you need a drupal installation and the cck, views, modalframe, jquery_ui module. I use admin_menu too.
Content types
We create a content type for each actor (person, project and partner).
Node reference fields
Now we have to setup the node reference fields for each content type
- Partner
field_project
(cardinality unlimited)
- Person
field_project
(cardinality unlimited)
This field already exists, so we can use it again

field_partner
- Project
field_projectcoordinator
field_leadpartner
Node relationship
We can now use the node relationship module.
In the edit form of the content type you have now an additional tab Relationships.
The first impression you get is the wonderful entity relations diagramm. It is automatically drawn by the node relationsships module and shows all relations (from and to) of the content type partner.
Behind the second tab (Node reference extras) you find the reference to fields and you can configure how it should behave in the edit form of the partner content type. For reference searching you can choose a view. You can create own views by cloning the predefined noderelationships_noderef view. The cloned view will appear in the options list. In my case, I used the standard table style view. If you check the box Create and reference it is possible to create a new project and reference it from the edit form of the partner content type.
This sounds all a bit theoretical, so here is the partner edit form with the project referencefield. The users can use the usual way to find a relationships via autocompletion. The cool icons at the right side of the field are the part of the node relationsships module.
After clicking at one of these icons a popup opens. Depending on the icon, it is a list view (which you can change in the configuration) with a filter or an add form for a new project.
With these tools, it is easy to set the references.
The third and last tab are the Back reference settings. Here you configure, how relationships from other content types are displayed. In our case we have relations from the person and the project content type.
In the next screenshot you see the backreferences from the person content type.
That's it :-)
Results
With this node relationships module it is very easy to organize references between nodes. Play a little bit around and you will see, how easy it is!
The results are also visible at eu.cocoate.com.
I often have the problem to visualize relationships between nodes. Sometimes I use blocks in views with parameters, sometimes I embed views in node templates and so on. Another problem is often the kind of relationship between nodes. Sometimes they have a relationship vice versa, sometimes not. But I don't want to bother you with these things ...The reason why I am writing this entry is, that I have found a good module helping me to get my job done: noderelationships.The Task: Who is doing what with whom?We have three actors: persons, partners and projectsWe want to have a website with a few relationships















10 commentaires
great write up
thanks hagen for writing this. I think most of us where looking for a solution like this. I personally never found it... roger
Node Relationships - Stream: this post can't be referenced.
Share Who To go here
Thanks for the article. Do
Backreferences from...
it is not a shame, you're
it is not a shame, you're perfect miss; i couldnt find this solution for months thanks a lot
Changing the label of a back reference
Default Views in Back References settings
Thanks for the article. Do
Thanks for the article.
Do you know if there is any way to change the label of the backreference "field"? The one that says "Back references from X in Y"
Regards
Thanks David, I had been
Thanks David, I had been trying to figure that out and post this post. It's a shame you have to create a whole new view though. I already feel like I have too many views.
Publier un nouveau commentaire