Company Overview

A leader in the world’s open source community, OpenConcept’s commitment to building a sustainable world infuses everything we do.  We believe the power of the Internet should be available to everyone. We work to make our clients' sites accessible to people in multiple languages, with a range of abilities, using a variety devices, all around the world … all people.

Learn More

Views integration with the relation module

introduction

Relations is an awesome new module for Drupal 7. It essentially allows you to link any entities together and which are themselves fieldable. I can think of limitless ways in which this can be super useful. However, the topic of this blog posting is not to heap praise on relations and explain in detail what they can be used for; I'll let you discover that yourselves. The intention is rather to give a practical example of how to create views of separate entity types tied together with relations. Something that I've had to play around with for hours to figure out. Perhaps this will save you some time.

Note: ​At the time of writing this the functionality I'm discussing only exists in the dev release of relation. Beta3 does contain this. If people from the future are reading this blog the functionality was commited Jan 21st by chx.

​An Example relation

Just read about this example on the d.o. issue queue where someone needed help with the views integration. So, lets say we create a relation that defines a relationship between a user and nodes called 'follow'. So that is to say a user can select particular nodes they deem interesting and choose to follow them.

Note: ​This could be accomplished other ways as well such as using the flags module, but we'll ignore that for now and consider that a relation can probably give us more functionality. 

We add a field to the 'follow' relation called 'category' to categorize the nodes which the user is following.

So now what we have is a directional relation user -> node ​with the single field 'category'.

Developers Needed

We are always looking for Drupal developers to add to our team! If you are interested or know someone who might be, please check out our posting. 

Join the team...

Follow your audience wherever they are.

Take your website from desktop, to tablet, to mobile browsing, with Drupal. Eliminate the need for costly, platform-specific mobile applications with a mobile friendly website. Your Drupal website can quickly adapt to however your users want to view it.

Evolve to Mobile

Shining a light on Open Source

OpenConcept is Canada's leading developer of Opensource technology online. Opensource technology offers better quality, higher reliability, more flexibility, lower cost, and an end to predatory vendor lock-in.

Learn More...

Together At Last

OpenConcept Consulting takes a step into the future of the web with HTML5. Witness the power of lightning fast and super stable in-page video with the stunning effects of jQuery. Accessible, sleek and flexible: HTML5 is where our heart is...

Make the leap...