I've found various recipes/threads with the scenario where have a content type A node and want to display in a sidebar block, all the related content type B nodes, with the relationship based on an entity reference field on content type B. Example and another

I've attempted to adapt these instructions to my situation, without success. My case is sort of flipped.

Content type: Resource
Content type: Source
Entity reference field: On the Resource content type, named source_select

So I have a bunch of Resource nodes that have a single source selected for each.

What I want to do:

On each Resource node, I want to show info from fields of its one related Source in a sidebar block.

What happens:

For every combination of configuration options I've been able to think of or draw from other threads, etc., I get an empty block.

One example:

View display: block
View filter: published = yes
Contextual filter: Content: Source (field_select_source)
Provide default: enabled
Default type: Content ID from URL

I feel like I'm missing something obvious--and I've successfully built working contextual filter blocks before in D7, but I don't have any of those sites operating now and can't remember what the secret was and can't seem to crack it again now.

2 Answers 2


You want to create a view of Source nodes, then set a contextual filter for the Resource ID. This way, when you are on a Resource page, the Resource ID will be in the URL. The contextual filter will use this to limit the Source nodes (which your View is showing) to any sources referenced by that Resource, which in your case will be a single Source node. Then you can display the Source node either as a teaser (or create a custom view mode and use that), or you can display fields.


Pieces fell into place after a short nap.

Here's how you do it...


The contextual filter will be to display in the sidebar bock the same Resource node (matches the NID) loaded as a full node.

A relationship is needed to display field data for the related Source. In this situation, you don't contextual filter on the Source at all.

For me, it worked best to set them up in that order.

  1. Settings to get the current node filtered into a sidebar Views block:

Provide default value: enabled
Type: "Content ID from URL"

Save the View.

At this point, I did a bit of testing by putting a nid in the "Preview with contextual filters" field below the View. Worked as expected.

  1. Settings for Relationship to Source.

Relationship: Content referenced from field_select_source (important: This is not the same as the "Content using..." option)
Require this relationship: enabled (this may not be necessary, but made sense to me and works)

Apply and save the view.

  1. Add fields from Source and choose the "field_select_source: Content" in the Relationship dropdown for each field.

Add the block to sidebar region for Resource nodes. That's it.

Result: Each Resource has a sidebar block showing Source information.

Edit: Jaypan's answer posted while I was writing this. It sounds more like how to display Resources while viewing the Source, which is the flipside of the relationship. But maybe that can work also.

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.