Streamline content creation and association using Node Relationships

#Drupal | Posted

Drupal developers use node reference fields all the time to relate one specific node directly to another (or many others).

However, there are limitations inherent with using a run-of-the-mill node reference field from a workflow and UX perspectives:

  • Creating my node is dependent upon creating a related supporting node
  • I don't know the name of the node that I want to relate to the node I'm creating

In OpenPublish 2.x, we have been using the Node Relationships module to alleviate these issues. A great example of this lies in the way that we've modeled Authors as nodes (since in many cases, an author != a actual Drupal user) and Slideshows as nodes (create each Photo as a node and provide lots of metadata about it while assembling the Slideshow it will appear in on the fly).

Relate the node you're creating to one that doesn't exist yet

If authors are nodes, and I'm creating an article by an author who's never written for me before, I have to go and create the author node first and then reference it from the article I'm creating, right? Wrong.

When you've enabled and properly configured Node Relationships for a particular node reference field, you'll see a set of buttons on the right of that field including a "Create and reference" button.

Clicking this will trigger a popup window containing another node creation form - just fill it out and submit it and it will populate the node reference on the Article you're creating with the newly created node!

Relate the node you're creating to a node you don't know the name of

The button containing the Search icon adjacent to Create and Reference allows you to view a list of existing nodes in a popup, with filters for node type, taxonomy, etc to refine the list. 

You can click on the one you'd like and the node reference is populated accordingly.


As the Semantic Web continues to gain traction and visibility, it's easy to forget the importance of allowing content producers to establish direct links between specific pieces content on their site.  Node Relationships makes establishing a node-to-node reference much efficient for site developers and administrators.


Dave Leonard