function theme_panels_tabs_style_render_panel in Panels Tabs 6
Same name and namespace in other branches
- 5 panels_tabs.module \theme_panels_tabs_style_render_panel()
Render panel callback (legacy).
File
- plugins/
styles/ tabs.inc, line 78 - Definition of the 'tabs' panel style.
Code
function theme_panels_tabs_style_render_panel($display, $owner_id, $panes, $settings) {
$output = '';
// Generate a unique id based on the CSS ID and the name of the panel in the
// layout.
$id = '';
//If CSS ID is set.
if ($display->css_id) {
$id = "{$display->css_id}-";
}
$pane_id = reset(array_keys($panes));
$id .= $display->content[$pane_id]->panel;
// Add the Javascript to the page, and save the settings for this panel.
_panels_tabs_add_js($id, $settings['filling_tabs']);
$tabs = array();
$tabs[$id] = array(
'#type' => 'tabset',
'#tabset_name' => $id,
);
$index = 0;
foreach ($panes as $pane_id => $content) {
// Remove the title from the content. We don't want titles in both the tab
// and the content associated with the tab.
if ($content->content) {
$content_without_title = drupal_clone($content);
unset($content_without_title->title);
$tabs[$id][$pane_id] = array(
'#type' => 'tabpage',
'#title' => $content->title,
'#content' => theme('panels_pane', $content_without_title, $display->content[$pane_id], $display),
'#weight' => $index,
);
$index++;
}
}
// No content has been rendered
if (empty($index)) {
return;
}
// See if an optional title was added.
$output = '';
if (!empty($settings['title'])) {
$output .= theme('panels_tabs_title', $settings['title']);
}
$output .= tabs_render($tabs);
return $output;
}