0

I have a content type called "Unit Staff" with a term reference field called "Department". I also have a vocabulary called "Person" which is using a paragraph field consisting of a date field and the same "Department" vocabulary as a term reference. Every department has several child terms. I want to create "Unit Staff" pages where I only select the unit name and a block will display all persons using the taxonomy term.

I have already all page views for every department but if something needs to be changed, I have to go through +30 pages and update them manually. I hope this way to be able to use one view for 30 units/departments.

In other words, I need a view for child taxonomy terms whose parent term is defined in a node taxonomy reference field.

Any help is appreciated.

1

You actually want to list sibling entities, with another level of complication in between: the paragraph reference.

Both Unit staff and Person reference Department taxonomy, only the Person does it through a paragraph.

Had there been no paragraf and the reference was direct you could simply follow the sibling taxonomy tutorials to get what you want.

Here's an example:
Building views relationship with location

and one with additional complexity:
Views Contextual Filter by taxonomy in field collection

In your case the chained Relationships will be:

Unit staff to Department term reference > Reverse Relationship from Department to Paragraph > Reverse Relationship from Paragraph to Person.

Then you add the Person (Term Name) to your Fields, it will use the last Relationship.

This gives you a list of Unit staff nodes, each with related Persons.

If you want to show a block of Persons on Unit staff pages add the Contextual ID filter for the ID, Default value ID from URL (the most common case). Place the block on Unit staff pages, adjust the contextual options, and the block will show Persons related to the Department of that Unit staff.

| improve this answer | |
  • Thanks a lot, it worked. As the field names were repetitive and very similar, be it paragraph referenced from.... paragraph using... taxonomy using... etc. I got lost. I followed your advice and after the second relationship was set, I was able to retrieve the last missing relationship. Again, thanks a lot! – Hermes Jun 26 at 11:19
  • I'm glad to hear it worked and I'm happy to help :) – prkos Jun 26 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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