Closed (fixed)
Project:
Views Bootstrap
Version:
5.5.0-alpha1
Component:
Tabs
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Feb 2018 at 22:21 UTC
Updated:
27 May 2024 at 21:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
vslklv commentedCreated checkbox if you want to group content by tab field.
Comment #3
vslklv commentedComment #4
universalhandle commentedI needed this for a Drupal 7 site. A patch based off of @vslklv's work is attached. It works great if you need to group results once.
Unfortunately, this doesn't really go far enough for my needs. In my case, I'm building a schedule for an event. If I set the tab field to my "day of week" field and check the new "Group by tab field" box, I get the expected tabs for Monday, Tuesday, etc. However, there's no way to group beneath that (e.g., by time of day or topic). When I select my "time of day" field for grouping, the grouping occurs before my "day of week" tab field. So, whereas I'm looking for something like:
+ Monday
++ 9 am
+++ Item 1
+++ Item 2
++ 12 pm
+++ Item 3
+++ Item 4
+ Tuesday
++ 9 am
+++ Item 5
+++ Item 6
... I end up with something like:
+ 9 am
++ Monday
+++ Item 1
+++ Item 2
++ Tuesday
+++ Item 5
+++ Item 6
+ 12 pm
++ Monday
+++ Item 3
+++ Item 4
... and to boot the display is a mess.
I think this approach is ultimately wrongheaded, but since I did the work to backport it and someone else might find it useful, I thought I'd share.
I tried an alternate approach where I overrode
views_plugin_style->render_grouping_sets()inViewsBootstrapTabPluginStyle(with one difference being that rather than using an explicit setting like @vslklv did, my code looks for the tab field and the first grouping field to have the same value), but I'm not sure that's the right place to intercept Views's default behavior either. Ultimately I gave up trying to do this in a generic way and hardcoded some implementation-specific details in an implementation oftemplate_preprocess_views_bootstrap_tab_plugin_style.Comment #5
catherineahayes commentedThis was super helpful for me, GinkgoFJG. Thanks! One possible improvement. I was getting "undefined offset" messages at line 32, so changed to this instead and they went away:
Comment #6
paulsheldrake commentedHello
The patch in #2 had an issue with the removal of the orginal grouping if statement that hid the setting form. I have re-rolled the patch to fix the settings form.
Comment #7
paulsheldrake commentedSorry, didn't export all the changes in the last patch. This one should be good.
Comment #8
paulsheldrake commentedUpdate patch for fix on tab labels from here https://www.drupal.org/project/views_bootstrap/issues/2997294
Comment #9
gabriel.nunez commentedAny updates on this? I applied the last patch and it stills shows a tab per element in the view, showing duplicates in my case. The "Group by tab field" option is checked.
Comment #10
chris matthews commentedComment #11
chris matthews commentedComment #12
shelaneComment #14
shelaneComment #15
Nikitoring commentedYou fixed, but in develop version in ViewsBootstrapTab.php file last close bracket is is error
Comment #16
shelane@Nikitoring I'm not sure what you mean that the last close bracket is in error. The close bracket on line 99 closes the buildOptionsForm function and the close bracket on 101 closes the ViewsBootstrapTab class.
Comment #18
d.sibaud commentedCan't find the expeted code in the a063e7f commit,
I here with attach a patch done against the current dev version.
Comment #19
shelane@tourtools. I'm not sure what you are trying to do in the patch. I am using the Views grouping that is built-in which your patch turns off. That grouping allows you to select a field to group by and handles the work of creating the rows. You have also removed improvements I made to the template with the patch.
Grouping does work in the current version:
See the documentation for Tabs.
Comment #20
d.sibaud commentedHello @shelane,
I'm trying to add what was done by @vslklv, @universalhandle and @paulsheldrake in their patches:
in other words, using the views' grouping behavior to group contents with the same grouping field value in the same tab.
Is less useful grouping several tabs with one content per tab under the same grouping field value than to have several nodes with the same grouping field value all under the same tab (see screenshot).
Comment #21
shelaneWhile that does seem like a nice feature:
1) Create a new issue and not remark on one marked as fixed.
2) I do not plan to take away the views based grouping option. Any other features will have to be in addition to that.
3) Be aware of what you are trying to change in the template as what was in the patch was destructive.
Comment #22
d.sibaud commented1) the issue was marked as fixed but the commit done doesn't answer to the true feature request underlying the title: the one expressed by the reporter and the following developer who tried to improve his first patch
2) absolutely agree, better to add the availability to choose between keeping the views standard grouping behavior and the one requested with this feature request issue overriding the first only if the "Group by tab field" is checked
3) I'll try my best in the future to avoid changing what already done good, thanks
Comment #23
shelane1) point taken
I am reopening this to continue investigating this issue.
Comment #24
shelaneComment #25
shelaneAfter evaluating the proposed code changes, I’ve decided that the approach can have some very strange outcomes if there is any pager in place. I’d rather continue to use the default views grouping (which also has its purpose) than trying to do some loop and catch of the row data. I thought I had seen this discussed before and I did. The issue for the 7.x version is now linked. I understand what you want to do here, but I think you can accomplish this by adding the Views Field View module.
Comment #26
ey commentedI'm reopening this issue, because it is still not working for the 8.x-4.x. There's no option for grouping.
Comment #27
ey commentedComment #28
ericmaster commentedRe-rolled the patch in #8 against 8.x-4.x.
Comment #29
yassersammanJust fix the wrong brackets in the last re-roll against 8.x-4.x, and a minor fix for t function.
Although I still don't know why we need to unset($form['grouping'])
It seems unnecessary.
Comment #30
anas_maw commentedFixed active state and added fade effect
Comment #31
anas_maw commentedComment #35
shelaneUnassigning myself since this is now assigned to the 4.x branch.
Comment #36
steveoriolRe-rolled the patch for 8.x-3.x.
Comment #37
steveoriolChanged tab grouping pattern to work when tabs are generated with "Global: Custom text" and other fields...
Comment #38
webdrips commentedRe-roll of #30 against the latest 8.-4.-dev branch
Comment #39
webdrips commentedComment #40
webdrips commentedLet's try this again: re-roll of #30 against the latest 8.-4.-dev branch
Comment #41
shelaneComment #42
suresh prabhu parkala commentedRe-rolled patch from #40 against latest 5.4.x-dev. Please review.
Comment #43
ronraney commentedIs anyone working on a patch for the alpha release? I tried the patch and it didn't work. I did get it working with custom code. I don't trust myself to create a patch because I don't have git working. I basically modified the same files where applicable.
Comment #44
ronraney commentedI think options for sorting the tabs using the Tab form would be a good addition. Options for sorting could be provided programmatically but it's beyond my capacity to contribute at this time. Even if it were only alphabetical, that would be helpful to me.
Comment #45
Pawel Bozyk commentedHi, the patch from comment #42 doesn't work with views_bootstrap 5.5.x, so I'm uploading a new one. Created and tested for Drupal 9.5.2
Comment #46
Pawel Bozyk commentedComment #47
shelaneAn issue is not considered fixed until code has been committed and the project maintainer has marked it as fixed. I'm setting this back as RTBC for now until I get a moment to test and commit code.
Comment #48
ammar qala commentedHi, the patch from comment #45 doesn't work with views_bootstrap 5.5.0-alpha1, so I'm uploading a new one. Created and tested for Drupal 10.2.3
Comment #49
ammar qala commentedwhen the tab is
<a></a>tag it doesn't work on views_bootstrap 5.5.0-alpha1switching from a tag to button.
Comment #52
shelaneComment #53
shelaneFYI, I am currently doing a deeper dive on tabs and this particular implementation will not be the final.