1
votes

I'm using the References module in Drupal 7 to do the following: I have projects and clients (content types), so that a project can belong to many clients, and a client can have many projects. I set this up using a Node reference field on the Project content type, which accepts unlimited values. What I need is a view (Views module) that shows a list of clients, and inside each one the projects that belong to it, like this:

Client 1
  - project 1
  - project 2

Client 2
  (no projects)

Client 3
  - project 45
  - project 2

With links to the projects' pages.

I don't know how the view should be set up. I tried using the User aggregation option in the Advanced section of the view editor, with no luck whatsoever.

1

1 Answers

1
votes

Add a contextual filter of client field in project view page. Go to client view and add Content: Nid and a Global: Custom text field. In Custom text field go to custom text rewrite results -> and select Output this field as a link. In Link path give value as page_to_list_projects/[nid].

Basically we are passing client nid as argument to the project list page and filtering projects with client nid.