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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ndewhurst created an issue. See original summary.

ndewhurst’s picture

Here'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.

ndewhurst’s picture

Assigned: ndewhurst » Unassigned
Status: Needs work » Needs review
jay.lee.bio’s picture

Status: Needs review » Reviewed & tested by the community

Great 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."

NWOM’s picture

#2 worked great. Thank you!

Edit: Still applies cleanly to the newest dev.