I need a view that shows (certain fields of) both the main entity (pointed to by the url) and all of the entities that have a certain relationship with it.
For example:
my entities IDs are 1,2,11 and 21.
Entities 11 and 21 have the relationship “member of” with 1.
I want the URL mysite.com/entity/1 to show this list
- entity 1 //(the entity from the url)
- entity 11 //(related to entity 1 via “member of”)
- entity 21 //(related to entity 1 via “member of”)
whereas mysite.com/entity/2 should show only entity id 2.
contextual filters should be the answers, I tried using the OR tweak
https://www.drupal.org/node/1451218#comment-6136692
and
https://www.drupal.org/project/views_contextual_filters_or
but when both the contextual filters (the one without relationship, and the one via the ‘member of’ relationship) are present, only one of them is being set to the query (the 1st one) or hook_views_query_alter is not being called at all.