Very nice question!
I give you every detail step by step, including the structure of content types.
First install Field Collection Views module. This will add a default View in Views menu. Its name is field_collection_view
. Clone this view (recommended) or edit the existing one.
Content Type X
This is the Manage Fields of this content type
It contains a Title
and a Field Collection field that I called xxx
. This is the xxx
It only contains an Entity reference to y
, I called it field_reference_xxx
(you can also include other fields, for our purpose it is unnecessary).
Content Type y
It only has Title
field and nothing else.
I inserted the exact content you included in the question.
Node1 (x
) to abd
and bca
Node2 (x
) to bca
and cde
field_collection_view View
This is the main work to do. The default View of field collection is in /admin/structure/views/view/field_collection_view
path. Open it.
First you need to add two Relationships :
Entity Reference: Referenced Entity
A bridge to the Content entity that is referenced via field_reference_xxx
Make sure to select referenced not referencing
and the second one:
Field collection item: Entity with the xxx (field_field_collection)
Relate each Content using xxx.
I supposed the Contextual Filter for selecting is Title of content type y
, right? so let's do it. add Title as contextual filter and make it to use (Content entity referenced from field_reference_xxx) Content: Title
relationships.
So far so good. Now go to Fields section. select Title
as a field and make it to use (field_field_collection) relationships. I mean this
AND NOW OUR WORK IS DONE!
In the aggregate This should be your configuration
For testing I give you the following screenshots to make sure it works
Without any value
With bca
With abc
and cde
Good Luck!