Thursday, July 21, 2016

Views - Drupal 7: use nested fields from field collections

In this scenario, the content type includes:
  • Field: Title
  • Collection field: Reviews
Collection field: Reviews contains:
  • Review text
  • Year
The purpose here is to use the nested field "Year" as a filter.

Step 1. Create a view page add add the fields (should go under "FIELDS"):
  • Field: Title
  • Collection field: Reviews
Step 2. Add a "RELATIONSHIP" (under "Advanced") and look for the field called Reviews (which is the name of our field collection)

Click "Apply"

Now make sure "Require this relationship" is checked

Step 3. Click "Add" under "SORT CRITERIA" and the nested field "Year" should be available.

That's it!

Feel free to comment if you have any questions.

No comments:

Post a Comment