Drupal Views Relationships
Video Guide to Drupal 7 Views Relationships
In this video find out how to add relationships in Views, how to use relationships to get node data in a list of files and how to use relationships to get data from referenced nodes in a node list.
The basic idea of relationships is starting with an object (e.g. a file), then tying-in (relating) another object (e.g. a node) to the original. The result is being able to select properties from the both objects (e.g. the file and the related node).
Adding a Relationship Options
When we add a relationship e.g. for a files, we get a choice of basic relationship options;
- File Usage: Comment - where a comment is associated with the file
- File Usage: Content - where content is associated with the file
- File Usage: Taxonomy Term - a taxonomy term associated with the file
- File Usage: Taxonomy Vocabulary - a taxonomy vocabulary associated with the file and
- File Usage: User - the user associated with the file
Configuring Relationships
Once we have created a relationship we can configure the relationship settings by entering an Identifier to use for the administrative label and giving the relationship an Administrative title. A choice can be made to require the relationship - which when enabled will hide items that don't contain the relationship.
More Views Fields
Adding a relationship to a view provides a large choice of field options derived from the related object, giving many more possible options to sort and organise the display of the view. The additional fields are available form content type "Manage Fields" admin tab from where they can be added to the content type.
Note on References:
The References Module is required for many Views Relationships options. The Basic references module v 7.x-2.0 is stable and suitable for production sites, however users should note many of the contributed modules adding options to basic references are still in development phases.
The range of options references and views relationships have available will expand vastly as these modules reach production site status (or be brave and try them anyway!)
Video Credit
Learn Views with NodeOne, part 11: Relationships from NodeOne.se

