Problem/Motivation
The module currently offers a "Hide empty tabs" option, which causes tabs to be omitted from a set if they contain no meaningful content or if the current user does not have permission to view the content therein. However, this option is not supported when tabs are rendered asynchronously.
Proposed resolution
Revise the prepareContents() method of the QuickSet class so that it does not skip the "hide/nullify empty tabs" step for sets that use AJAX mode. Tweak the code that prepares tabs in AJAX mode to expect the possibility of hidden tabs.
Remaining tasks
Test/review.
User interface changes
The "Hide empty tabs" checkbox on quicktab/quickset admin pages will no longer include the caveat "This option does not work in ajax mode."
API changes
Any programmatically managed quicktabs will be able to use AJAX mode and instruct the tab set to hide empty tabs.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | quicktabs-allow_empty_tab_hiding_in_ajax_mode-2577937-1.patch | 4 KB | ndewhurst |
Comments
Comment #2
ndewhurstHere's a patch that makes the basic changes mentioned above. I reviewed the project repo to get some sense of this feature's history: it seems the "hide empty tabs" option was introduced as a synchronous-mode-only option from the start (rather than AJAX support being removed later in response to some other issue). However, I don't see an obvious reason for not supporting it in AJAX mode.
This patch appears to be working nicely on the site where I've tested it so far. I don't have time to review further with different scenarios. Can someone (perhaps someone more familiar with this module) test it in different Quick Tab configurations? It seems there must be a deeper reason for this not being supported already, but maybe it was just a matter of dev/testing time commitment.
Comment #3
ndewhurstComment #4
jay.lee.bio CreditAttribution: jay.lee.bio commentedGreat job, @ndewhurst. #2 works perfectly (even for 7.x-3.6 that I'm using). But I also strongly recommend using this in conjunction with another patch (https://www.drupal.org/node/2222805, #2) that gets rid of the following infamous error:
"There are no contents to render."
Comment #5
NWOM CreditAttribution: NWOM commented#2 worked great. Thank you!
Edit: Still applies cleanly to the newest dev.