Skip to main content
16 events
when toggle format what by license comment
Aug 13, 2018 at 22:24 comment added usernameabc I ended up using your answer and was able to get rid of my custom code :-)
Aug 13, 2018 at 22:23 vote accept usernameabc
Aug 13, 2018 at 21:36 comment added prkos I added the suggestions to my Answer for completeness, even if you already solved the html in your own way.
Aug 13, 2018 at 21:35 history edited prkos CC BY-SA 4.0
Added ideas from D7 (Better exposed filters) and Summary through Contextual filter
Aug 13, 2018 at 20:06 comment added usernameabc In that answer you recommended to use a Better Exposed Filter (I can't believe I didn't think of that). Using twig and css I modified the exposed filter to get what I need. Would it be possible to modify your answer to reflect the exposed filter suggestion, I can mark it appropriately as it is closer to what I was looking for?
Aug 13, 2018 at 19:41 comment added prkos You haven't mentioned if you already have the tabs javascript ready, is the HTML output the only thing you need? Maybe there is a way to solve it without custom code, using only Views and Rewriting output a bit. I recently posted an answer to a similar problem but for D7, with the help of some extra modules but no custom code Filter a view by clicking on a link on another view.
Aug 13, 2018 at 18:34 vote accept usernameabc
Aug 13, 2018 at 20:04
Aug 13, 2018 at 18:33 comment added usernameabc Yes, the order is important as the <div class='view-groups'> will be displayed as tabs. When the tabs are clicked, then the content below will switch to the result set where type = <select tab> (for example). The view sort criteria needs to be kept. Thinking further, the only way we see making this work mytheme_preprocess_views_view and custom twig template, which is what i was trying to avoid. In either way, your answer did get us closer to making it work.
Aug 13, 2018 at 17:39 comment added prkos Is the order important in itself, or only that it matches between two displays? The perfect solution might be to use Summary option through a Contextual filter, only it's usually sorted alphabetically or by number of results in each category.
Aug 13, 2018 at 17:23 comment added usernameabc everything in the <div class='view-groups'> should be returned based on the results. Group by term is meant to mean that we will display all Blog results with each other (e.g. Page Title1, Page Title2, Page Title3 are listed together since they are blogs, but Page Title5 and Page Title6 display below that). Since Blog is listed first in the view-groups we want the result set to have Page Title1, Page Title2, Page Title3 to be listed first as well.
Aug 13, 2018 at 16:40 comment added prkos Heh yes, now the problem looks a bit different. You could possibly try Aggregation on the Display that lists only the Taxonomy terms. Or create a new Views block of type Taxonomy term that has the same Filters applied (through Relationships to Content) so you get the accurate term set, maybe even clone the default Taxonomy Views that is of type Content and adjust the filters there to show the terms. Is it important to keep the terms list "linked" to the results, so it only shows the terms that had been used in results? I guess it depends on what you mean by "group by term".
Aug 13, 2018 at 16:23 comment added usernameabc I updated the example in the question to better show the results. You are correct in that the attachment view's filter criteria is meant to show multiple nodes of the same term so that we always group by Page Types that are linked to a node.
Aug 13, 2018 at 16:13 comment added prkos I woudn't expect any filtering issues here since it's a fairly simple case. Are you sure you have all the settings the same between the page and attachment Displays? Only the Fields that are shown should be different. Filters should be the same. Or maybe you have more than one node of the same term but you want the Attachment to only list it once?
Aug 13, 2018 at 16:01 vote accept usernameabc
Aug 13, 2018 at 16:20
Aug 13, 2018 at 16:01 comment added usernameabc we were able to use the attachment. The issue we ran into was that it was returning Blog (for example) for every Basic page that met the criteria. As a result we had to override the templates to get it to display just the grouping we need.
Aug 11, 2018 at 15:23 history answered prkos CC BY-SA 4.0