The views integration works pretty well.

I have a country view. I'd like to create a relationship to contents or entities that are related to the country. Similar to an "Entity Reference: Referencing entity".
It is a backward relationship.

When I look into the Advanced tab and add a relationship, I only get the Entity translation as I use translations. But no referencing entities relationship.

Is this possible ? Am I missing something ?

Comments

IT-Cru’s picture

This would be very helpfull. I have a country content type, which hold country, images and body and a tour content type which also have a country field. I want to show all matching tours for this country content type.

A filtering only for the continent would be also nice.

Perhaps someone have a working view with some custom PHP code to share.

semanthis’s picture

What actually would be needed is "Views integration to provide reverse relationships" just the same as we have on taxonomy terms or entity references. But using hook_field_views_data_views_data_alter() will not work the same way as it works width e.g. taxonomy-terms. "views_handler_relationship_entity_reverse" expects that the value stored in the field_data_table is the id and not the iso2-value. As far as I understand it would be necessary to create a new views-handler views_handler_relationship_country_reverse to solve that problem...but that's where things get too complicated for me.
Anyway - I believe this is a real issue, beeing able to use this reverse relationships is something I would expect from such a module. I really wonder why this module stores the iso2-codes into the field-data-table instead of the cid.

Does anyone have a work-around to solve that problem? Thanks in advance