Been searching and cannot find this anywhere for Drupal 8. Very basic view request, can't figure out why it's not straightforward.

I want a View that shows Parent content and under it all Children content. Nothing to do with taxonomy, just want this to display in a view:

Parent Content 1
- Child content 1
- Child content 2
- Child content 3

When trying a contextual filter, I get "This display does not have a source for contextual filters, so no contextual filter value will be available unless you select 'Provide default'."

  • Is there an Entity reference field connection between your Parent and Child nodes, from Child to Parent? Is the way you listed it all in one row the way you need it? Can you add more rows to your example to show what you're after? – prkos Mar 19 at 17:55
  • Yes, there is an entity reference field which I have been trying to get to work but can't. stackexchange formatted it. I just want each parent to show a list of associated children next to it in the view. Right now it shows all children of all parents and my contextual filter removes all. – user92628 Mar 20 at 7:32

It doesn't seem your situation calls for contextual filters, you're not listing anything dependent on circumstances, you aim to list all of the Children, and group them by parent.

Since it's Children being referencing Parent nodes all you have to do to solve this is to a create Views that list Children, add the Parent field (the entity reference field you have on Child nodes), then under your Format settings set the Grouping field Nr.1 to the Parent entity reference field. This is how you display the children nodes in a sort of a hierarchy based on which Parent they reference.

You can edit that Field settings if you want to Exclude from display and you can change the Style settings, the grouping output will take that into consideration most of the time.

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.