Using D8, I'm putting together a genealogy site for my family and having a hard time creating a block that lists the brothers and sisters of the Person being displayed.

The basic unit of the site is the content type, "Person". Each Person node has their first and last name and date of birth.

After much deliberation, I settled on defining relationships between people with a content type called "Relationship" that has two fields, Person A and Person B (both drawn from existing Person nodes), and a taxonomy tag to define how they are related (Mother, Father, Spouse, etc.). To aid in having some predictable logic, I've decided that parents will always be Person A and children will be Person B.

I started down the road of defining sibling relationships explicitly with a "Sibling" tag on a Relationship node (Ann is Bob's sibling, Ann is Claire's sibling, etc.), but for families with many siblings, that creates a need to create definitions for every sibling match variation (Bob is Claire's sibling). To simplify things, I'd like to use the logic that all people with the same mother are siblings (the real world introduces other complications, but I'm trying to handle the most basic scenario first).

I've set up a View, based on the Relationship content type, with a Block display and an EVA display. The EVA display is attached to the Person content type. I've selected "Use the ID of the entity the view is attached to" to "populate the view's arguments."

I've set one Filter Criteria to dictate that "Field Relationship = 'Mother'". I'm trying to set another Filter Criteria to use the logic of "Field Person A is the same as that on the Relationship node where Field Person B is ID (as taken from current node)." The list would then display all the Person B names that had the same Person A. (To not list the person whose node was currently being displayed, I could then add a filter to exclude the Relationship node where Person B is ID [as taken from current node].)

I've turned on the modules, Token and Token in Views Filter Criteria. Not surprisingly, this does not reveal a token for "Person A from Relationship node where Person B is ID(as taken from current node)."

How do I get this block to recognize and filter based on "Field Person A is the same as the Person A on the Relationship node where Field Person B is the Person being currently viewed?" Screen shot of current settings attached.

Thanks in advance!

enter image description here

  • Does this answer your question? Contextual views - show articles that the current user is interested in
    – No Sssweat
    Dec 30, 2020 at 2:19
  • Thank you, but I don't think so. This example displays nodes that are tagged with the interests of the logged in user. My example would be more like if you wanted to list other users with the same interests, but the interests were recorded in a separate content type with just the user name and their interest. The two pages on this google jamboard attempt to show the difference between the two scenarios: jamboard.google.com/d/… Dec 30, 2020 at 13:11
  • You could roll your own token? cloudways.com/blog/create-custom-drupal-token-modules
    – Beau
    Dec 30, 2020 at 22:59
  • I think a better configuration would have been Taxonomy hierarchy or Taxonomy with additional fields on the Vocabulary to describe the connection. But in the end I think it comes down to creating sibling Views. They can be created for Taxonomy connections, and Entity Reference connections, your Relationship config seems like the ER case. You can find answers here for similar examples. Basically you add Relationship for the ER field, chain another, reverse Relationship, and add the Contextual ID filter that uses the second Relationship.
    – prkos
    Dec 31, 2020 at 11:20


Your Answer

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

Browse other questions tagged or ask your own question.