I am running Drupal 7.8, QT 7.x-3.x-dev, and Views 7.x-3.x-dev.

I have a Quicktabs instance with two tabs, each displaying a view. That QT instance is set to hide empty tabs.

When the views are set to display as an unformatted list, empty views are hidden as expected. However, if the views are set to display as a Media Player, the same empty view is no longer hidden.

This may be more of an issue with how the Mediafront module implements the views display, but I was hoping to get some feedback here.

Comments

katbailey’s picture

Category: bug » support

Quicktabs can't possible guess at what constitutes "empty" content for all possible things you could put in tabs. It just checks if any markup is returned.

brycesenz’s picture

Understandable. I have posted this issue in the Mediafront queue, since I guess it should be fixed there.

For reference though, can you point me to the line/code that checks whether the quicktabs content is empty? It would make finding the disconnect much easier.

hexabinaer’s picture

brycesenz, wouldn't http://drupal.org/node/766924#comment-3485870 be a solution for you?

brycesenz’s picture

Unfortunately, it's not quite a solution. I ended up dropping MediaFront in favor of another module that doesn't exhibit this issue, but there still seems to be a fundamental disconnect between the way some modules that implement Views style plugins return data and what is expected by quicktabs.

katbailey is right that it's not QT's responsibility to check for whatever each module decides to return when it is empty, but it would still be helpful to note somewhere in the documentation what exactly the module looks for to determine emptiness so that patches can be easily made for other modules.

stealthtech1’s picture

I noticed that even though the view was empty it still generated empty div tags.

I then did an override on the view templates and removed all unnecessary html.

But a Krumo dump showed that the view result still had 2 characters in it.

So i minimized the files ensuring that there are no line breaks or hidden spaces anywhere.

Krumo dump now showed that the tab contents result now had 0 characters.

But this still didnt hide the tab.

I then did this small hack to accommodate an empty string:

Quicktabs.classes.inc on line 191 I changed:
if (empty($contents)) {
to:
if (empty($contents['#markup'])) {

That fixed it for me.

henrijs.seso’s picture

I would go further and suggest stripping all tags/whitespaces from #markup with something nuclear

Managed to fix issue with NOT NULL filter for field to be displayed in view.

Jan van Diepen’s picture

My situation is as follows:

I have a quicktabs definition that has a view displays on its tabs. One of the view displays is using the quicktabs style plugin, with more views on the tabs. On these subtabs I wanted to hide the empty tabs. This is not working since hide_empty_tabs defaults to 0 (FALSE).

I added the tab_hide_empty_tabs option to the plugins settings form, to allow the user to decide whether to hide empty tabs or not.

At that moment I ran into the problem that the tabs were not recognized as being empty. Just like stealthtech1 in #5 I noticed that the content holds an empty string in '#markup'. To solve this I added some extra checks on the first line of the constructor of Class QuickPreRenderedContent which is used to render the content of the subtabs.
A similar solution should also do the trick for other classes.
I'm not sure how this translates to the initial Media Player issue.

Please find the patch below.

Binu Varghese’s picture

Issue summary: View changes

First off, after you create a quick tab instance, select the the option to "Hide empty tabs" (Make sure the ajax mode is not set).

Now, if the view is truly empty, the tab will gracefully disappear from the tabs. But, how to ensure that the views output is truly empty?

- Simply add a views "filter" setup for the entity you are trying to display set to "Is not empty (NOT NULL)".

Cheers!

smustgrave’s picture

Status: Active » Closed (outdated)

With D7 EOL approaching in a month I'm starting to triage the D7 side of quicktabs queue.

If still an issue or needed for 4.0.x (latest branch) feel free to reopen