So I'm using QuickTabs to feed a View tab type into the QuickTabs block. However if there's no content in the view (the View is only showing published content) then the block is still showing up with the Quick Tab link - but with no content. I want the block to disappear if there's no content. I only want the block to show up when there's active published content being fed into the View, and therefore into the QuickTab block.

Is this possible?

-backdrifting

Comments

ambientdrup’s picture

Additionally I have Hide empty tabs selected but the tab is still showing up without any content in it (when there's no content published).

-backdrifting

u4yk’s picture

I'm currently having this problem as well.

mohirt’s picture

We are not alone. I applied the patch here: http://drupal.org/node/292150 #31 and installed the latest dev and it doesn't fix the problem. I might have to go with another solution.

katbailey’s picture

A fix for this was committed a couple of weeks ago - see #640598: Hide empty views tabs (w/o exposed filters) and try the latest dev version.

mohirt’s picture

hi kat, I have the latest dev installed and it's still not working for me. I tried losing all my arguments then created a separate view for each tab and still no go. I'm stumped.

Currently the setup is 5 block display's in one view using the argument below to separate the information accordingly.

$path = drupal_get_path_alias($_GET['q']);
$path = explode('/', $path);
if ($path[0] == 'products' && $path[1] != '') {
return $path[1];
}

===============VIEW=======================================//>

$view = new view;
$view->name = 'products_tabs';
$view->description = 'Products Tabbed Content';
$view->tag = 'Products';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'field_tab_specifications_value' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_tab_specifications_value',
'table' => 'node_data_field_tab_specifications',
'field' => 'field_tab_specifications_value',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('arguments', array(
'title' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => '',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'php',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 0,
'limit' => '0',
'case' => 'none',
'path_case' => 'none',
'transform_dash' => 1,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'3' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_php' => '$path = drupal_get_path_alias($_GET[\'q\']);
$path = explode(\'/\', $path);
if ($path[0] == \'products\' && $path[1] != \'\') {
return $path[1];
}',
'validate_argument_node_type' => array(
'box' => 0,
'case_study' => 0,
'news_event' => 0,
'page' => 0,
'product' => 0,
'resource' => 0,
'slideshow' => 0,
'solution' => 0,
'tutorial' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'3' => 0,
'16' => 0,
'4' => 0,
'6' => 0,
'15' => 0,
'10' => 0,
'11' => 0,
'13' => 0,
'5' => 0,
'19' => 0,
'20' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_php' => '',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'product' => 'product',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('header_format', '2');
$handler->override_option('header_empty', 0);
$handler->override_option('row_options', array(
'inline' => array(),
'separator' => '',
'hide_empty' => 1,
));
$handler = $view->new_display('block', 'Overview Tabs', 'block_1');
$handler->override_option('fields', array(
'field_tab_overview_value' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_tab_overview_value',
'table' => 'node_data_field_tab_overview',
'field' => 'field_tab_overview_value',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'Benefit Tabs', 'block_2');
$handler->override_option('fields', array(
'field_tab_benefits_value' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_tab_benefits_value',
'table' => 'node_data_field_tab_benefits',
'field' => 'field_tab_benefits_value',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'Specifications Tabs', 'block_3');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'Supported Tabs', 'block_4');
$handler->override_option('fields', array(
'field_tab_supported_standards_value' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_tab_supported_standards_value',
'table' => 'node_data_field_tab_supported_standards',
'field' => 'field_tab_supported_standards_value',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'Deployment Tabs', 'block_5');
$handler->override_option('fields', array(
'field_tab_deployment_options_value' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_tab_deployment_options_value',
'table' => 'node_data_field_tab_deployment_options',
'field' => 'field_tab_deployment_options_value',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);

jangolden’s picture

I'm also having this problem with the latest dev release. Quicktabs are using a view with an argument passed. View has no result but quicktab is still displaying. Quicktab option of 'hide empty tabs' is checked. I really need this functionality! Any help or workaround would be appreciated!

We were able to fix this problem by adding this code after line 520 in quicktabs.module.

 /* This fixes tabs from showing up when they are empty. */
             $fieldname = $view->field['field_results_value']->field_alias;
             $counter = 0;
             if ($view->result && $hide_empty)
             {
                 foreach ($view->result AS $key => $viewresult)
                 {
                    if ($viewresult)
                    {
                       foreach ($viewresult AS $vkey => $vvalue)
                       {
                          if ($vkey != 'nid' && $vkey != 'node_type' && $vkey != 'node_vid')
                          {
                             if ($vvalue)
                             {
                                $counter++;
                             }
                          }
                       }
                    }
                 }
             }

             if (!$counter)
             {
               return '';
             }
             /* We should only get this far if the tab was filled with something. */

arbel’s picture

in the latest version it isn't after line 20 but after this code:

$cache[$cachekey] = $output;

and before this:

return $output;

Thanks!

mattcasey’s picture

Having same issue. The quicktabs block in a panel does display my Views with arguments, but will not hide when the fields are empty. I have set the fields to hide from the View and QuickTab settings. Using CTools 6.x-1.6, Panels 6.x-3.5, and Views 6.x-3.0-alpha2 - upgraded to Quick Tabs 6.x-2.x-dev with no luck!

Thanks for the support

christian_m’s picture

I had a similar issue while trying to display in a tab one field of the current node, using a view with argument and a page display. The tab would not disappear, even if the field was empty...

Finally I had an illumination and added a filter to my view to return only nodes where that field was not empty...
And presto! The tab disappeared as expected when there was no content in that field.

I figured out that QT did not check whether their was any content for the tab, but rather whether the view returned any nodes. If no node is found that matches the filters, then QT assumes that the tab is gonna be empty and removes it.

Hope this can help someone.

Macronomicus’s picture

yay #9 .. that was it!
Cheers!

mattcasey’s picture

That should work for whole nodes, but I'm using QT to display tabs for separate fields on the same node..

christian_m’s picture

Do you mean one field per tab? That is exactly what I am doing.

If you intend to display more than one field per tab (if your view return more than one field), then you may need an OR condition in your Views filters. The Views Or module seems to address just that but I have not tried it.

devkinetic’s picture

#9 worked for me as well. Its a quirky solution, and I can definitely see cases where this still wouldn't work, but thankfully in my case it did.

wiliam_steven’s picture

StatusFileSize
new6.55 KB

Hi guys,

same problem here, i have adding new menu and the menu items are authenticated user only can see it, but when i adding it to Quicktabs the tab is not hidden, even i have check the hide the empty tabs in Quicktabs option.

Is there solution for this kind of problem ?

When i inspect the element for the empty tab, I have found the

inside the div of current tab.

Thanks

elektrorl’s picture

this is not a solution, isn't it possible to check whith jquery if there is text, somthing like this:
$('.quicktabs_tabpage .view-content',context).filter(function () {
return $.trim($(this).text()) === ''
}).parent().remove();

except it has to be in the quicktabs.js. I don't know where to place it and what I need to do with parent().remove because it must remove the ul li tab too.

Please it has to be fixed and a lot of problems will be fixed on sites with many informations.

elektrorl’s picture

I thinks the best solution is to provide a view tpl with if else condition, if there is content it prints the actual way. If no content it prints nothing. But I'm not a php tpl fan. What do you think of this solution?

wiliam_steven’s picture

Hi, I think that one of many solution, but to find the right tpl is one of many thing problem too...

but i will trying too find the tpl.

Pocketpain’s picture

Sub!

Pocketpain’s picture

Sub!

alanpeart’s picture

The problem is in quicktabs.module.

$tabs_count = count($quicktabs['tabs']);
  if ($tabs_count <= 0) {
    return '';
  }

This is supposed to count the tabs, and if nothing is found, then return a blank, causing the block to be hidden. But if there's no content in the tab, it still has an index and it still gets counted.

I hacked quicktabs.module and changed this to

	$tabs_count = 0;
  foreach($quicktabs['tabs'] as $key=>$value) {
	if($value) {
		$tabs_count++;
	}
  }

  if ($tabs_count <= 0) {
    return '';
  }

This did the job for me. Now if there's no content in any of the tabs, the entire quicktab block doesn't get rendered.

katbailey’s picture

@alanpeart - it's only a hack when you don't submit a patch, hint hint ;-)
The fix for this will likely be different for the 3.x branch than for the 2.x branch, due to #1003748: Direct link broken when tab is hidden - yours looks like a fix for 6.x-3.x, though I haven't looked into it properly yet, will try and get to it in the next couple of days.
P.S. I believe we met in a former life (Muckross/Gonzaga :-P), so... hello!

giorgio79’s picture

sub

giorgio79’s picture

sub

whatsupdrew’s picture

Version: 6.x-2.0-rc4 » 6.x-3.0
Component: User interface » Code

Kat, We are having the same issue. We know there is no content because we put in empty text. Any plans to run the update from the hack from #20?

sunland’s picture

Version: 6.x-3.0 » 7.x-3.2
Category: support » bug
Priority: Normal » Major

Tabs with views with no content at all are still showing. Of course, this implies the block always showing.
Te correct behavior should be:
- If no content in a tab: hide tab
- If no content in any tab: hide block

hexabinaer’s picture

@whatsupdrew/#24: I reckon delivering empty text wouldn't equal "no content". In fact, you are rendering content telling the user that there's no data ;-)

Nevertheless, for the moment it seems to be the only practical solution (empty text) - although, thinking of a user's perspective, it's no good style to raise the expectation of further content by displaying a link leading kind-of-nowhere.
I agree with #25 that it's necessary to return such behavior.

Is "this option does not work in ajax mode" meant to be a temporary workaround information? Or in other words: Are there plans to "fix" this?

(I don't intend to sound demanding. Unfortunately, as a non-developer, I can only offer testing.)

ayesh’s picture

Same here.
+1 for #25

zkrebs’s picture

Version: 7.x-3.2 » 6.x-3.1

In the 6.x series of Quicktabs, can't hide tabs with a view w/ arg with no result by clicking the hide empty tab feature.

EDIT : I apologize for changing the version of the code - did not anticipate that might derail the maintainers. Please fix as you see fit.

Chasen’s picture

Version: 6.x-3.1 » 7.x-3.2

*Changed version back to original, as per #28

I am having this issue as well. I have 6 quicktabs for a product display (features, description, specs, gallery, etc) and all of which are set as views (tried setting them as blocks too, didn't help) in quicktabs and even though the views are empty the tabs are still displaying. I agree that it's a complicated issue because even though the display is visually empty, the code is not...

PixelClever’s picture

For 6.x The solution at comment #20 works well. Seems like a pretty straight forward fix. Definitely too small to be worth creating a formal patch for it.

chi’s picture

StatusFileSize
new491 bytes

Here is patch for 6.x-3.x

kim.le’s picture

Okay, I see patches/fixes for Drupal 6 but are there any for Drupal 7?

zrodimel’s picture

Priority: Major » Normal

^^^ What he said ^^^

justkristin’s picture

Same problem here (7.x-3.x). I would love a setup as described in #25. No love?

JohnnyW’s picture

Version: 7.x-3.2 » 6.x-3.x-dev

Having exact same problem with 6x3.1

Help pretty pleeeeze :)

justkristin’s picture

Version: 6.x-3.x-dev » 7.x-3.4

Please create a new issue ticket for different versions...

chi’s picture

It's not best practice to create many issues for one problem. We should fix it in the latest version and then make backport.

castawaybcn’s picture

Version: 7.x-3.4 » 7.x-3.x-dev

patch in #31 did not make the trick for me, tab is still showing for an empty view with node arguments. I had to use the "not empty relationship" trick instead. Using 6-x.3.1

Anonymous’s picture

Fix for this is to add a filter that only returns results if NOT NULL.

tmsss’s picture

The patch on #31 did the trick for me. Thanks!

q11q11’s picture

Here is patch for 7.x

q11q11’s picture

StatusFileSize
new588 bytes

Corrected version of #41

Chasen’s picture

works for me, thanks!

rv0’s picture

patches in #41 and #42 are not working..
At least not when using blocks
They hide everything because the #markup field is nested deeper

Similar approach with codechange works:


        reset($contents);
        if (empty($contents[key($contents)]['#markup'])) {

calefilm’s picture

I can't get #42 to work. I'm using views. I applied the patch to both 7.x-3.4 and dev but no changes. The patch applied correctly though, "patching file quicktabs.classes.inc"

Update: for now, I'm using the #9 solution

calefilm’s picture

Hi rv0.. i'm somewhat drupal challenged. Where would I place that code? Thank you!

rv0’s picture

That code is not a perfect fix, hence no patch, but you can place it in the same place that the patch in #42 does. (just open the file in texteditor ;) )

calefilm’s picture

Thank you!

Bernsch’s picture

Status: Active » Needs work

@maintainers or q11q11
Please, can you write a finished patch from #42 an #44
Then we can test it or mark it as fixed.
Thanks!

amanire’s picture

Status: Needs work » Needs review
StatusFileSize
new631 bytes

This patch combines #42 and #44. Tested and works for me.

Exploratus’s picture

I wanted to add that for some reason, if you have selected and enabled AJAX when in quuicktabs rendered, and then switch to another one, and dont disable AJAX, the module still thinks you are using ajax and the empty panels will still render, since using AJAX disables this feature.

I was using accordion renderer and empty panels where showing up. I moved back to quicktabs, switched ajax from on to off, and back to the accordion. Bam, my empty panels stopped rendering. :)

kenpeter’s picture

Version: 7.x-3.x-dev » 7.x-3.5
Category: bug » support
StatusFileSize
new896 bytes

Add condition

strlen($contents[key($contents)]['#markup']) == 1

to #50. Not sure why, but it works for me.

Status: Needs review » Needs work

The last submitted patch, quicktabs_dont_hide_if_no_content_7.x-3.5-766924-52.patch, failed testing.

ultimateboy’s picture

Version: 7.x-3.5 » 7.x-3.x-dev
Category: support » bug
Status: Needs work » Needs review
ultimateboy’s picture

cafuego’s picture

On a Drupal 7.23 with latest Views this patch caused QuickTabs containing a #markup => 'My tab content' array to not be displayed, despite there being content.

cafuego’s picture

Issue summary: View changes
Status: Needs review » Needs work
cafuego’s picture

Status: Needs work » Needs review
StatusFileSize
new801 bytes

Attached an updated patch. This will obviously fail when the contents aren't a render array, is there a use case where that could happen? In that case we need an extra is_array() check.

randa.elayan’s picture

I have the same issue, and none of the patches worked for me.

cafuego’s picture

Can you check what the contents are of the tab that won't hide? I found that one of mine contained a single space, causing quicktabs to not hide it.

randa.elayan’s picture

I am using quicktabs for displaying one field of the content type in each tab.
Each comes from a view.
I traced the code and the issue for my case is in here:
if (empty($contents)) {
...

When the $tab is rendered, it has the html of the view

div class="view view-product-solutions-items view-id-product_solutions_items view-display-id-product_post_forming_block view-dom-id-ddc6cb0823fcd0415feef2511bbeefbc"
div class="view-content"
div class="views-row views-row-1 views-row-odd views-row-first views-row-last"
div class="views-field views-field-field-post-forming"
div class="field-content" /div
/div
/div
/div
/div--

There is no actual content, but this will not pass the if (empty($contents)) {

What is the solution for this?

cafuego’s picture

How far can you get by removing as much as possible of the wrapping html in the view config? Or see if the 'Hide if empty' checkbox on the field means the view then returns nothing...

heresh’s picture

Added the patch that hides the tabs even if only html tags are present without content

heresh’s picture

StatusFileSize
new773 bytes

Realized that my last patch would strip <img> and <input> tags by mistake.

idcm’s picture

I applied patch #64 and all my tabs disappeared. with and without content.

Binu Varghese’s picture

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!

simone960’s picture

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

I have tried this method, although this way indeed make the empty tab disappear but when I click the rest of the tabs, it doesn't seems working correctly as all the tab page/content of the tab remain hidden when you click on any of those. "quicktabs-hide" class remain on all tab page. Any idea?

idcm’s picture

I too went to great lengths to ensure the view was empty and it didn't matter.

zuruckzugehen’s picture

although this way indeed make the empty tab disappear but when I click the rest of the tabs, it doesn't seems working correctly as all the tab page/content of the tab remain hidden when you click on any of those

The same is happening to me. Anyone found a solution?

arodriguezju’s picture

although this way indeed make the empty tab disappear but when I click the rest of the tabs, it doesn't seems working correctly as all the tab page/content of the tab remain hidden when you click on any of those

is there already a solution for this? The "hide" feature is the reason I have tried to use Quicktabs.

Thanks!

alain dg’s picture

good to know: If you don't apply the patch and use, instead, the additional filter strategy, you might want to use as well DISTINCT in query parameter, to avoid duplicates for multiple value fields...

Eranga’s picture

What worked for me is editing quicktabs.classes.inc file as follows in drupal 7.34

- if (empty($contents)) {

+ reset($contents);
+ $string = strip_tags($contents['#markup']);
+ $string = trim($string); // If string contain only white spaces it will be removed
+ if (!$string) {

AgentJay’s picture

#72 worked for me, this should be committed.

lachezar.valchev’s picture

StatusFileSize
new1.24 KB

Hi,

Here is the suggested solution from #72 formatted as patch against 7.x-3.x-dev.

For me that worked but only in the style is ui-tabs. If the style is quicktabs I have the issue with the missing other tabs as well.

Regards,
Lachezar

lachezar.valchev’s picture

And here is one against the current stable 7.x-3.6

Regards,
Lachezar

lachezar.valchev’s picture

StatusFileSize
new1.36 KB

Hi,

Here is a new patch as the last one was causing notices.
This one should apply to 7.x-3.x and 7.x-3.6

Regards,
Lachezar

nitesh sethia’s picture

Status: Needs review » Reviewed & tested by the community

This patch works as expected. So changing the status of to RTBC.

thommyboy’s picture

This line does not work properly in any condition strip_tags($contents['#markup']);
as there might be contents (e.g. a block) resulting in $contents[block_x]['#markup']
otherwise working for me...

sardis’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.19 KB

So instead of checking out the type of the quicktab and finding delta of the block, which we have to use to get to the '#markup' key of the array, we could simply call another reset() function, which will get needed "contents".
And finally there should be covered all the cases of empty tab contents.

Here comes the patch.

sardis’s picture

StatusFileSize
new1.19 KB

Didn't notice little grammar mistake.

Re-uploading patch with this fix.

nwom’s picture

If a Quicktab contains a view, and the logged in user has no access to the view (due to his role), the quicktab is still shown with #80 and #76, even though no content is shown. Does the patch work with this use-case?

millionleaves’s picture

I confirm that the patch in #80 did the trick for me:

- Quick tab with two tabs, both populated with views
- Hide Empty Views enabled
- The second tab view is sometimes empty. The tab was still appearing.
- Applying patch stopped the second tab from appearing when the view was empty.

Thanks! Not sure I'm a large enough test population change this to "Reviewed and tested by the community" but it gets my vote nonetheless.

Gnanasampandan Velmurgan’s picture

I'm using QuickTabs to product Ingredients a View tab type into the QuickTabs block.
However if there's no content in the view then the block is still showing up with the Quick Tab link - but with no content. After applying the above #80 patch my problem is solved.

Thanks

nwom’s picture

Status: Needs review » Reviewed & tested by the community

Setting to RTBC then since we have multiple reports that the patch works as expected.

karivolas’s picture

Is this project active? Can we have this patch applied?

shelane’s picture

Assigned: Unassigned » shelane

I recently became a maintainer on this project. I am currently working through some Drupal 8/9 issues to get a full release out. I do plan on coming back around to 7 though and working on issues such as this.

  • shelane committed fb41f7b on 7.x-3.x authored by Sardis
    Issue #766924 by lachezar.valchev, q11q11, Sardis, heresh, cafuego, Chi...
shelane’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.