You are here

function theme_panels_tabs_style_render_panel in Panels Tabs 5

Same name and namespace in other branches
  1. 6 plugins/styles/tabs.inc \theme_panels_tabs_style_render_panel()

Render callback.

File

./panels_tabs.module, line 35
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.
  $pane_id = reset(array_keys($panes));
  $panel = $display->content[$pane_id]->panel;
  $id = "{$display->css_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',
  );
  $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++;
    }
  }
  $output = tabs_render($tabs);
  return $output;
}