I'm in the process of upgrading a site from 4.7 to 5.x, so the problems I'm running into are on a core codebase of 5.0. The jstools module is 5.x-06, and I've kept the site in Garland to make sure there's nothing in our custom theme that's contributing to the problem.
We use tabs extensively on the 4.7 version of this site -- mostly by having the code in the node-content_xxxxx.tpl.php files, but occasionally using it directly in a block or a node's CCK field. At first I thought the problem was just that in 5.x, tabs could no longer be dropped into the template files like that -- I could get them to display in a standard node's body copy, but not elsewhere.
When trying to troubleshoot, though, I discovered that even in those cases, any code or text that comes below the tab code does not display -- it's as though the rendering hangs after spitting out the tabset.
To do a simple test, I dropped the README.txt example code into the body of a standard page node:
$form = array();
$form['example1'] = array(
'#type' => 'tabset',
);
$form['example1']['tab1'] = array(
'#type' => 'tabpage',
'#title' => t('One'),
'#content' => t('First tab content.'),
);
$form['example1']['tab2'] = array(
'#type' => 'tabpage',
'#title' => t('Two'),
'#content' => t('Second tab content.'),
);
$form['example1']['tab3'] = array(
'#type' => 'tabpage',
'#title' => t('Three'),
'#content' => t('Third tab content.'),
);
return tabs_render($form);
followed by this:
<br />Let's see if this text will display...
When you view the resulting page, you get the basic functioning tabset -- but not the line of text that follows.
We have the Developer module turned on to help test -- here's what you get in the "Dev Load" tab for this node:
<?php $form = array(); $form['example1'] = array( '#type' => 'tabset', ); $form['example1']['tab1'] = array( '#type' => 'tabpage', '#title' => t('One'), '#content' => t('First tab content.'), ); $form['example1']['tab2'] = array( '#type' => 'tabpage', '#title' => t('Two'), '#content' => t('Second tab content.'), ); $form['example1']['tab3'] = array( '#type' => 'tabpage', '#title' => t('Three'), '#content' => t('Third tab content.'), ); return tabs_render($form); ?> <br />Let's see if this text will display...
And here's what you get in the "Dev Render" tab:
<div class="drupal-tabs"><ul class="anchors"><li><a href="#example1-1" tabindex="1">One</a></li><li><a href="#example1-2" tabindex="2">Two</a></li><li><a href="#example1-3" tabindex="3">Three</a></li></ul><div id="example1-1" class="fragment"><h2 class="drupal-tabs-title">One</h2>First tab content.</div><div id="example1-2" class="fragment"><h2 class="drupal-tabs-title">Two</h2>Second tab content.</div><div id="example1-3" class="fragment"><h2 class="drupal-tabs-title">Three</h2>Third tab content.</div></div>
(Sorry for the lack of line breaks -- but I wanted to cut-and-paste it exactly as it appears.)
When I put similar sample code directly into node.tpl.php (or any of the customized versions), not even the tabset displays -- and you still have the "everything-that-follows-gets-lost" problem.
Any idea what the cause is? I even tried using the 5.x-1.x-dev version -- which seems to be older, and still has return theme('tabs_tabset', $tabs); approach -- and it had the same basic problem.
Is it possible that there's been a change from 5.0 to 5.1 in core that's an issue? Is anyone else having this problem? Or am I just lucky and/or overlooking the obvious?....
Thanks
TKS
Comments
Comment #1
nedjoTry
print tabs_render($form)instead ofreturn tabs_render($form).Comment #2
TKS commentedThat does it -- both in the body field and in the .tpl files. Thanks!
Comment #3
(not verified) commented