With Drupal 7's Views, with the Entity API module enabled, you gain the ability to display an entity in the view's result as a field. This provides a result very similar to the "Content" and "Rendered entity" row plugins (the ability to display entities rendered with a specified view mode), with one key difference: you can use the "Grouping field" options under the format options!
I've been using this approach more and more as I become comfortable with view modes. It's especially useful when your entity has many fields that result complex grouping logic, custom preprocessors, and detailed structural requirements and conditions that can be difficult and confusing to handle by throwing each item in as a Views field.
An additional bonus to rendering content via view modes is that it can expose the contextual links for node management right in the list, meaning one less page load for an administrator who looks for content within the context of the site.
With Entity API in D8 core, I assumed that this functionality could be built out quite easily. Except that there's no longer a "Rendered Content" option:
At this point, I was at a loss. Since Drupal 8 has pretty fully embraced view modes, it doesn't make sense that this ability to have both fields and rendered entities used in a view was removed (unless it became technically impossible, but that seemed unlikely).
I went down the rabbit hole on this one, starting by searching to see if anybody else was asking about this option going missing. I couldn't find anything, but I couldn't be the only person who had discovered this powerful combination -- could I? Well fine. Maybe I can have the view provide the node id, then use some combination of template file and preprocess function to render the node in the view mode I wanted? Likely possible, but I was getting frustrated, coming up on a deadline, and it would just be quicker to create the groupings I needed as individual block displays (with the grouping value already specified). I put the problem down and decided to come back to it later.
I'm glad I did.
Coming back to the problem with fresh eyes, I took one last look around before I resigned myself to building out the 5×6 = 30 block displays. I noticed the "Force using fields" style plugin option, and actually read the description text. (Side note, I get really annoyed when admin themes hide field descriptions -- yes I'm looking at you Rubik.)
After hitting Apply once to save the "Force using fields" setting, I see the option to group by fields (after you've added some to the view, of course).
Oh, that's what it does.
It was only as I started writing up this blog post to help anyone else that might be stymied by this issue, that I noticed the "Force using fields" already existed in Drupal 7. So maybe I am the only person who stumbled across this wacky variant that requires an extra module.
But I decided to share this post, just in case.
Posted February 13, 2016 in Drupal 8