Score:0

Create a block with related content selected from "page" content type

us flag

I've two content-types:

'Page' and 'Bike'

From the page, I use a Entity reference field 'field_kies_je_leasefiets', where I link to several bikes.

I want to create a block, placed on the full node view of the 'page', to show a block with 'linked bikes on this page'.

I am struggeling to remember how I used to do this in the past. What 'CONTEXTUAL FILTERS' do I add? I tried 'NID', but that fails. Will someone please be so kind, to give me some pointers?

enter image description here

enter image description here enter image description here

And this is the solution, given by a user below:

make relation Give a descriptive name Apple contextual filter

cn flag
What is a block "with 'linked bikes on this page?" What are the linked bikes? The bike content type that is linked on the page? Or actual links to the bikes?
cn flag
Also, how did you configure the NID contextual filter? Usually in a case like this you can set the option for the NID contextual filter to `Provide default: Content ID from URL`.
user27604 avatar
us flag
First, thank you very much for taking the time to answer. Much appreciated. #1: With Views I output to a block, to be placed on the page. The linked bikes are linked with a entity reference 'field-kies-je-lease-fiets'. Will add pictures above...
Score:1
in flag

So you need a list of bikes that only show the ones referenced by the current page. What you'll need to do first is configure that view to list nodes filtered by the Bike type.

Then, in order to filter by the current Page it's on, you need two things:

  1. You need to bring in the Pages relating to the bikes in the list. To do this, add a reverse relationship (Bikes <- Page). It's reverse in a sense that we're bringing in content pointing to our list items, instead of content pointed by our list items. The description of this relationship should go like:

    Content using field_kies_je_leasefiets - Relate each Content with a field_kies_je_leasefiets set to the content item.

    Name this relationship "Page" administratively, so we can tell which one's which.

  2. Since we now have a reference to Page content via that relationship, add a contextual filter for ID, using the Content ID from URL option. The key piece is to use the Page relationship on this contextual filter so that it filters by Page's ID, not by Bike's ID.

After setting this up, you should now be able to filter Bike content by Page IDs in the preview.

user27604 avatar
us flag
Man, this post was usefull. For some reason I spend a couple of hours on this simple thing and I couldn't connect the dots in the right order. This post was succesfull, allthough I almost forgot to chech the box with: 'Configure contextual filter: Content: ID 'Relationshop': 'field_kies_je_lease_fiets (bikes linked from certain page). The tip to use a descriptive admin title here, was also usefull. Have a great weekend, and thanks again!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.