In Drupal 7, I have a Content Type, let's call it fruit. I have added an entity reference field to fruit to the user record. I want to create a view that lists all the fruit, but puts a mark next to those that have been ticked on their user record.

I am unable to work out how to do this, principally because I can't see how to add a Relationship to the user record.

Any help would be appreciated.

  • To clarify, you're wanting to mark fruit nodes that have an user entity reference to the current user looking at the view?
    – Shawn Conn
    Oct 16, 2015 at 19:29
  • The entity reference to the fruit nodes is on the User profile. But yes, I want to mark the fruit nodes for the current user. Thinking about it, perhaps adding the entity reference to the user profile wasn't be best approach...
    – James
    Oct 18, 2015 at 9:08
  • Hmm, that's the opposite of how read the question, but no matter. You can reference both sides of the relationship. I wrote an answer that discusses the heart of relationship referencing.
    – Shawn Conn
    Oct 18, 2015 at 19:06

1 Answer 1


For entity reference fields there are 2 types of relationships added to views: a Referenced entity and a Referencing entity.

  • Referenced entity is used for a reference from the base table (e.g. A user view that references a fruit node).

  • Referencing entity is used for a reference to the base table (e.g. a fruit node view that references a user)

In your case, it's Referencing entity that you want.

Create a node view and a Entity Reference: Referencing entity relationship (the description should read A bridge to the User entity that is referencing Content via field_FRUIT_NODE_REF) that refers to your fruit node reference.

That should handle the data/reference part. What remains is aggregation/filtering (e.g. there will duplicates if fruit node references aren't distinct for each user) and display (e.g. how to display marking a fruit node referencing a current user).

Depending on your needs, you might need a custom field/template since there is a limit of what you can do with field basic rewriting and default user contextual filters.

  • Thanks for this. I think this partly solves my problem. The issue is that the current user profile isn't one of the suggestions that comes up for Referencing entity in Views - so I need to work out how to get around that.
    – James
    Oct 21, 2015 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.