You are here

function theme_qt_tabs in Quick Tabs 5

Same name and namespace in other branches
  1. 6 quicktabs.module \theme_qt_tabs()
1 theme call to theme_qt_tabs()
quicktabs_form in ./quicktabs.module

File

./quicktabs.module, line 355

Code

function theme_qt_tabs($form) {
  $rows = array();
  $headers = array(
    t('Tab Title'),
    t('Weight'),
    module_exists('views') ? t('Tab type') : '',
    t('Content'),
    t('Remove'),
  );
  foreach (element_children($form) as $key) {

    // No need to print the field title every time.
    unset($form[$key]['tabtext']['#title'], $form[$key]['tabtype']['#title'], $form[$key]['bvid']['#title']);

    // Build the table row.
    $row = array(
      'data' => array(
        array(
          'data' => drupal_render($form[$key]['tabtext']),
          'class' => 'qt-tab-title',
        ),
        array(
          'data' => drupal_render($form[$key]['tabweight']),
          'class' => 'qt-tab-weight',
        ),
        module_exists('views') ? array(
          'data' => drupal_render($form[$key]['tabtype']),
          'class' => 'qt-tab-type',
        ) : array(
          'data' => '',
          'class' => 'qt-tabtype-hidden',
        ),
        array(
          'data' => drupal_render($form[$key]['bid']) . drupal_render($form[$key]['vid']) . drupal_render($form[$key]['args']) . drupal_render($form[$key]['limit']) . drupal_render($form[$key]['build']),
          'class' => 'qt-tab-bvid',
        ),
        array(
          'data' => drupal_render($form[$key]['remove']),
          'class' => 'qt-tab-remove',
        ),
      ),
    );

    // Add additional attributes to the row, such as a class for this row.
    if (isset($form[$key]['#attributes'])) {
      $row = array_merge($row, $form[$key]['#attributes']);
    }
    $rows[] = $row;
  }
  $output = theme('table', $headers, $rows, array(
    'id' => 'qt-tablist-table',
  ));
  $output .= drupal_render($form);
  return $output;
}