0

So I have user accounts and have added some custom fields to the user accounts. One of the fields is 'field_procedures' which is a entity reference to a content type called procedures.

Inside a view now, which is a calendar view, I want to display ONLY the procedure nodes that have been selected in the 'field_procedures' field that match that user. So that I am able to set which procedure nodes that are related to this user and want him to only see the calendar with of that node type he has been selected for.

I can't figure out how to set this up.

1 Answer 1

1

In Views add a relationship to the "Entity Reference: Referenced Entity", then add a contextual filter for UID with a default value taken from the URL.

See also http://codekarate.com/daily-dose-of-drupal/using-views-entity-reference-module-drupal-7

3
  • The only option I have for that field in relationships is. Entity Reference: Referencing entity A bridge to the User entity that is referencing Content via field_procedures seems the Referenced item is available for that field.
    – Atrium
    Commented Oct 14, 2014 at 21:11
  • Is your view of the suer table or the node table? It sounds like it is the user table, and it should be the node table.
    – fullerja
    Commented Oct 16, 2014 at 11:14
  • So this works for a single entity reference. However the user account has 2 fields that are entity references. If I add another relationship for that other entity reference and a contextual filter with UID for that new reference. Then it displays nothing. It seems that I can display one entity reference or the other but it will not let me display both at the same time. Do you have any ideas on how to fix this?
    – Atrium
    Commented Oct 29, 2014 at 19:59

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.