1

Is there a way to use grouping settings for Bootstrap Tabs in Views?

1
  • I believe there are issues with the Views Bootstrap module when it comes to grouping. Be sure to check this thread: drupal.org/node/2058399, and see if the dev-version of the module helps you out. Commented Jun 10, 2015 at 8:38

2 Answers 2

2

There isn't a way at the moment to use the built in views group by function, but luckily there is a way to accomplish similar behavior if you install a contrib module called views field view.

https://www.drupal.org/project/views_field_view

The premise being, tabs separate a listing of entities into multiple groups based on a common term.

Not like this: https://monosnap.com/file/K4W6m63A1jsy7frYdL8P0LfcFQPj29

But like this: https://monosnap.com/file/Q8WsRSgJU7f8AYFMMomDmcIjyOAXZE

In order to make this work, you need two views, One with the tab output, and another contextually filtered as a field within the first.

View 1 (list of taxonomy terms) would look like this to create the labels for the tabs: https://monosnap.com/file/h3fDlfgy2HwlHT2Y3Lywe8IroagDyE

View 2 (Use a relationship to call the nodes that are referencing each term and a contexual filter to limit the nodes per term id): The view field here is the key: https://monosnap.com/file/NtIumKYmsws62o4kTAnU72mt1LPZZq

Once you have the two views you can set the argument on view 1 The view field here is the key: https://monosnap.com/file/EzgRlcjLgr0au7TIWnTLbWEosCHwcP

2
  • 1
    This worked perfectly. As an aside for anyone else looking at this. View 1 is not supposed to have that relationship. My hunch is that Chris forgot to override the second block when creating this example. Also, when adding the view field (3rd step), you want to select your View 2 display mode (Give them unique names to avoid confusion). And lastly to note: If you make a bunch of changes on the secondary view that will display through the view field, you need to save the entire view for it to reflect in the field. Quirky quirks! Commented Nov 30, 2016 at 0:15
  • It's too bad that the momsnap files are no longer available. I would have loved to have seen these examples.
    – shelane
    Commented Oct 21, 2020 at 4:09
1

Unfortunately my reputation is too low to comment on Chris' answer; however, there is one important piece missing that took me awhile to figure out is that in order to have your tabs show only the unique taxonomy terms as shown in his "not like this / but like this" photos, you'll need to set "Use aggregation" on the "View 1" view to Yes.

Also, I have to disagree with Antonio's comment - I did find that the Relationship (which in Drupal 7.63 is called "Content: Taxonomy terms on node") was necessary on both views.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.