Last active
December 12, 2015 05:38
-
-
Save paulhhowells/4723095 to your computer and use it in GitHub Desktop.
Render Tabs — don’t print them if you don’t need ’em. Drupal 7.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add to template.php: | |
/* | |
* Implements template_preprocess_page | |
*/ | |
function THEMENAME_preprocess_page(&$variables, $hook) { | |
// create $render_tabs & $show_render_tabs for page.tpl | |
$render_tabs = render($variables['tabs']); | |
$variables['render_tabs'] = $render_tabs; | |
$variables['show_render_tabs'] = strlen($render_tabs) ? TRUE : FALSE; | |
} | |
add to page.tpl: | |
<?php if ($show_render_tabs): ?> | |
<div class="tabs"><?php print $render_tabs; ?></div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment