0

This is driving me crazy because it's so simple in Drupal 7.

Scenario:

Basic page has a entity referenced field where you can type in Spotlights that should be shown at the bottom of the page.

View:

Relationships (in order) is the field_spotlights (which exists on the Basic Page) and field_spotlight: Content using the previous relationship.

Contextual filter is the ID of the node, based on current id of page. Uses the field_spotlights relationship

Fields are the fields that exist in the spotlight, each with a relationship with field_spotlight: Content.

So the above should show only 3 results if the basic page is viewed and only has 3 spotlights in the entity referenced field.

However 4+ spotlights are showing, it's including the 3 that should show but then duplicates some or shows more.

UPDATE:

I've tried using Aggregation too, by adding a Content ID to the fields, and setting the aggregation setting to Count, Count Distinct, and Max/Min.

Also tried setting Distinct in the query settings.

screenshot of issue

  • Is your site multilingual? – 4k4 Sep 13 '18 at 16:49
  • Nope, it’s a fairly basic build – Travis Johnston Sep 13 '18 at 16:50
  • Check that you don't have a Sort applied that may be causing the duplication...I've had that cause it for me. – andileco Sep 13 '18 at 17:49
  • no issue there. I thought of that too since there may be elements that are not set to the right, or any, relationship. I just included a screenshot. – Travis Johnston Sep 13 '18 at 17:52
  • I feel like you want a View of basic pages (so your filter criteria should be "type: Basic page") and then your contextual filter would also filter by the basic page's NID, and then you would bring in the Spotlight content as you have through the fields using relationships. – andileco Sep 13 '18 at 18:00
0

I think you want a View of basic pages (meaning filtered down to Content Type = Basic page) with a contextual filter narrowing down to the current Basic page using the Content ID (NID). Then add in a relationship to Spotlight through the entity reference field. And then for your three fields, make them use the Spotlight relationship.

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.