2

I'm attempting to create a view which will show Photo Galleries that have a reference to a project. The project has a reference to a category. It is on the category page I want to show these galleries.

So I am on the category page, and would like to show the latest galleries posted within the projects in this category.

When creating the view for photo galleries I can display the project field, so I know what project they are in. However the category field is within the project node, so how can I find out what category the project has referenced?

I need to look at the node referenced in the project field, then take the category field from that to determine if it is associated to the current category. Is this possible within the fields module or should I look at something else?

Hopefully this question makes sense, if not please ask questions or edit the question. Thanks!

Edit: This is using Drupal 7 and I assume views 3.

2
  • Which version of Drupal and Views are you using? Views interface has changed quite a bit in recent times, so a good solution with screenshots, or linking you to a tutorial, depends on which versions you are using :). Ultimately though, you need to play with Relationships within Views.
    – DanH
    Aug 12, 2011 at 9:41
  • I edited the original post to say I'm using Drupal 7 and the core views within that (Views 3?). Not sure if anyone noticed though, still not solved this problem. Perhaps just listing all nodes then sorting it myself from within the template file?
    – Graeme
    Aug 19, 2011 at 5:37

1 Answer 1

2

I assume that you are using the References module to provide a Node Reference field to Photo Gallery nodes which reference Projects, and then provide another Node Reference field, or Term Reference field to Project nodes which reference Categories?

In Views:

  1. Expand the Advanced column
  2. Add a Relationship
  3. In the Add Relationships dialog, select the Photo Gallery: Project Node Reference field from the list
  4. In the Configure Relationship dialog, Click Apply
  5. Add another Relationship
  6. This time in the Add Relationships dialog, select the Project: Category Node/Term Reference field from the list.
  7. In the Configure Relationship dialog, there is a field labelled Relationship with a drop-down menu, which lets you choose other compatible relationships you've added previously, from which you should select the Photo Gallery: Project relationship (I'm not entirely certain what text to expect here). Then click Apply.
  8. Now when you add new Fields to the View, you'll have the option to select a Relationship for each individual field, which allows you to pull data from the entity (Node/Term) that is referenced by the selected Relationship

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.