0

I have two content types: Family and Members. Family content type has an entity reference field of type Member and can have unlimited values(multiple values). My question is: How to create a view that enables me to filter Members based on Family. Thanks

2 Answers 2

0
  • Add a Contextual Filter in your view, use the "Member" field (Entity Reference guess) from your content type "Family".
  • Then add a relation in Relationship section, using the same field (Member).
  • Add a Title field and use that relation.
  • Pass the NID of your family has an Contextual Filter in your preview... you might get all the members of that family.

Notice: in yout Contextual Filter you have to select how will you pass the Contextual Filter (Family's NID in this case). You can add it via URL, etc.

0

I am not very sure what you want to achieve, but you can approach it in 3 ways:

  1. you can display members like any other field on family page;
  2. you can create a block listing members on family page (or any page where you can provide family node id as contextual filter);
  3. you can create a drop-down of family node titles and select the select the family and corresponding list of members would appear.

  1. For the first situation you don't need views, you can do it with field UI: Goto Content Types > Family > Manage Display> Set Entity Reference field format to Rendered Entity
  2. For the second situation, you will have to create a block view ; his page has detailed instructions: https://www.drupal.org/node/1841004
  3. For the third situation you basically need to display the list of family as exposed filters in views; you might find this screen-cast helpful: https://youtu.be/4Pdii7aFIvc?t=16m15s

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.