You are here

function theme_double_field_tabs in Double Field 7.2

Implements theme_double_field_tabs().

File

./double_field.module, line 1262
Defines "Double field" field type.

Code

function theme_double_field_tabs($vars) {

  // Ensure that each passed HTML ID value only exists once on the page.
  static $instance = 0;
  $instance++;
  drupal_add_library('system', 'ui.tabs');
  drupal_add_js('jQuery(document).ready(function(){jQuery(".double-field-tabs").tabs();});', 'inline');
  $output = '';
  foreach ($vars['element']['#items'] as $delta => $item) {
    $id = 'tabs-' . $instance . '-' . $delta;
    $vars['items'][] = '<a href="#' . $id . '">' . $item['first'] . '</a>';
    $output .= '<div id="' . $id . '">' . $item['second'] . '</div>';
  }
  $output = '<div class="double-field-tabs">' . theme('item_list', $vars) . $output . '</div>';
  return $output;
}