Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When has no tabs on the page then an empty <div> goes to output. Like this: <div class="tabs clearfix"></div>
Because the $tabs variable in the region--content.tpl.php file is an array. Like this:
Array
(
[#theme] => menu_local_tasks
[#primary] =>
[#secondary] =>
)
This check is not enough: if ($tabs) :
This is better: if ($tabs && !empty($tabs['#primary']) :
Comment | File | Size | Author |
---|---|---|---|
#7 | tab_condition_omega-7x-4x_1332732-7.patch | 599 bytes | Chris Burge |
#3 | tab_condition_1332732-4.patch | 845 bytes | Hydra |
Comments
Comment #1
hmmdinger CreditAttribution: hmmdinger commentedAgreed. I just spent a good bit of time debugging some extra space in IE7 that ended up being because of this empty $tabs div.
Comment #2
othermachines CreditAttribution: othermachines commentedMarked #1385770: Tabs Wrapper printed even if tabs is empty as duplicate of this issue.
Comment #3
Hydra CreditAttribution: Hydra commentedHad this issue also some times...
Comment #4
Cellar Door CreditAttribution: Cellar Door commentedah IE7 how we love you so... :)
Comment #5
himerus CreditAttribution: himerus commentedComitted to 7.x-3.x
Comment #7
Chris Burge CreditAttribution: Chris Burge commentedRe-opening this issue as there is a regression in 7.x-4.x. The line is question is as follows in 7.x-4.x:
<?php print render($tabs); ?>
This results in the re-introduction of the bug fixed by this issue in 7.x-3.x. This issue proposes fixing the regression by changing the line as follows:
<?php print ($tabs && !empty($tabs['#primary']) ? render($tabs) : '' ); ?>
Patch is attached.
Comment #8
Chris Burge CreditAttribution: Chris Burge commentedI haven't tested either 7.x-5.x, and 8.x-5.x, but neither of these versions check
!empty($tabs['#primary']
. It is probable that this bug exists in both versions, too. I'll defer to someone more active with the project on those versions.Comment #9
Chris Burge CreditAttribution: Chris Burge commentedComment #10
tedfordgif CreditAttribution: tedfordgif commentedThis could be seen as a dupe of the core bug #997408: $tabs is always set, which is closed-as-duplicate in favor of the more general bug #953034: [meta] Themes improperly check renderable arrays when determining visibility.