I have 2 channels:survivors, survivorContent and a Category:themes. Relationships are as follows: survivorContent has -> related themes (max 3) AND survivorContent has -> related survivors (max 1)
Themes are always only one level deep.
I have a template that receives survivor.slug as a variable (based on a route). Given the survivor slug, I need to show a list of distinct themes that are indirectly related to this survivor (via the survivorContent->survivor relationship and the survivorContent->themes relationship). Then I need to show the survivorContent entries under each of those filtered themes that are related to both that theme and the given survivor to get output like this:
- Related Theme 1
- Related survivorContent1 (related to both the Survivor & Theme 1)
- Related survivorContent2 (related to both the Survivor & Theme 1)
- Related Theme 2
- Related survivorContent3 (related to both the Survivor & Theme 2)
- Related survivorContent1 (related to both the Survivor & Theme 2 as well as Theme 1, above)
I'm struggling to find a way to do this that is remotely efficient. Any ideas?