0

I have two content types, Project and Resource,

I have a view displaying fields from Projects, and I would like to display fields from resources referenced by projects in that view.

If I Twig debug, I can see the resource fields are available in the view, but I cannot output them using {{ fields.field_project_linked_resource.content }} or similar...

Any help much appreciated!

0

You can display information from nodes that are connected through Entity reference fields right in the Views interface.

In your case you're referencing Resources from Projects, so you need to add the Relationship for the Entity reference field, then you will be able to add Fields that you can find on the Resources Content type (they will automatically use the Relationship).

If it's a field that both Content types have (for example Title) then if you don't use the Relationship on it the title will be for the Project node, and if you do make it use the Relationship it will show the Resource title.

  • Thats great, thank you. But how do I output the referenced fields in my projects view twig template? say I have a field called 'field_resource_thumbnail_bg_col' how would I show that? – jim Mar 18 at 12:01
  • I've got it thanks for your help! – jim Mar 18 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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