If you are on home of a theme (e.g. bartik) you can see an empty <div class="tabs"></div> in the code. This also adds a gab

.tabs {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  margin-bottom: 20px;
}

in page.tpl.php the $tabs variable always evals to true:

      <?php if ($tabs): ?>
        <div class="tabs">
          <?php print render($tabs); ?>
        </div>
      <?php endif; ?>

the reason for the TRUE is inside template_preprocess_page(&$variables) where menu_local_tabs(); is called and always returns an array with 3 keys.

$variables['tabs'] = menu_local_tabs();

Comments

hass’s picture

Title: Empty tabs <div> rendered on home, <?php if ($tabs): ?> is always TRUE » Empty tabs <div> rendered, but <?php if ($tabs): ?> is always TRUE

Not only on home. Also in views and other places if the tabs are empty.

droplet’s picture

Status: Active » Closed (duplicate)

Many similar issues, some of them get fixed or duplicated or ... closed for some reason:

#1390576: Remove empty HTML tags
#997408: $tabs is always set

sachbearbeiter’s picture

as a workaround:

<?php if ($tabs = render($tabs)): ?>
    <div class="tabs">
    <?php print render($tabs); ?>
    </div>
<?php endif; ?>