0

Hello Drupal Views Experts

First time Drupal site builder newbie to stack overflow and sounds like this is the smart place to ask a query.

I have a content type "Policies". This content type has a reference field to content type " Client". "Users" also have a reference to content type "Client".

What I am trying to display in views, either through filter criteria or contextual filter, is display a table of "Policies", but only display the results of which the logged in user has reference to.

I.E Logged in user is referenced to "Client A" of content type "Client". There are a few policies of content type "Policy" which also have a reference to "Client A" of content type "Client". I only want logged in user to be able to see content from views with the same reference to "client".

Is filter criteria the way to go, or contextual filters? As I said. I am a newbie site builder and guidance would be amazing if you have the know how.

Here's hoping.

0

You can find answers here with detailed steps about how to do that. Search for "sibling entity reference" or something longer.

Basically, you do do it with a couple of Relationships and a Contextual filter. You need Relationships to get the referenced Content into your Views, because when you create Products views you will only have Products fields available.

So you create a list of Products, add the ER Relationship for the Client info, add another Relationship that is using the first one for the users referencing the Client, then you can add the User ID contextual filter that is using the second Relationship and set it to provide default value from Logged in user.

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.