I've got a Views listing, grouped by two fields. Within this, I have an entity reference with multiple entries.

What I want is to relocate the 2nd grouping title to below each listing. I've got a copy of the views-view-grouping--myview.html.twig in my theme. I'm not sure where to go for suggestions on tackling this. I know I can't affect fields from within this. I haven't yet found any good examples/tutorials that show me how to break apart those Headers. They're in the template as {{ title }}, I know that much. I just don't know how to break that apart and get something like {{Title.level_1}} and {{Title.level_2}}

So that I can do something like this:

{{ content }}

Please, someone, anyone? I'm struggling here and I've tried everything. Even tried to figure out a hook to preprocess the view. I've run into numerous problems. the underlying field is a global: custom text field. I'm at a complete loss for how to accomplish something that seems like it should be extremely simple.

maybe I've explained it badly? maybe you need more info?

I've tried using aggregation, that breaks everything. I've tried setting distinct, that does nothing. I've got it grouped twice, because the field I want to show at the bottom of everything appears multiple times - the same number of times that a referenced entity appears. A second grouping by this value gets rid of those, but gives me no means to put it lower.

I also tried using Views Field View. That doesn't work for me, either. The referenced Content ID gives no result.

Your Answer

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

Browse other questions tagged or ask your own question.