Same name and namespace in other branches
  1. 7.x-3.x quicktabs.admin.inc \theme_quicktabs_admin_form_tabs() 1 comment

Theme function for quicktabs admin page. Theme the form elements for the tabs as draggable table rows.

1 theme call to theme_quicktabs_admin_form_tabs()
_quicktabs_admin_main_form in includes/admin.inc
The main section of admin page.

File

includes/admin.inc, line 444

Code

function theme_quicktabs_admin_form_tabs($variables) {
    $tabs = $variables['tabs'];
    drupal_add_tabledrag('qt-tablist-table', 'order', 'sibling', 'qt-tabs-weight');
    $rows = array();
    $header = array(
        t('Tab title'),
        t('Tab weight'),
        t('Tab type'),
        t('Tab content'),
        t('Operations'),
    );
    foreach (element_children($tabs) as $key) {
        $tab =& $tabs[$key];
        $tab['weight']['#attributes']['class'] = array(
            'qt-tabs-weight',
        );
        // Build the table row.
        $row = array(
            'data' => array(
                array(
                    'data' => drupal_render($tab['title']),
                    'class' => array(
                        'qt-tab-title',
                    ),
                ),
                array(
                    'data' => drupal_render($tab['weight']),
                    'class' => array(
                        'qt-tab-weight',
                    ),
                ),
                array(
                    'data' => drupal_render($tab['type']),
                    'class' => array(
                        'qt-tab-type',
                    ),
                ),
                // tab content (only 1 tab content (block, node or view) will be displayed. see: quicktabs_form.js)
array(
                    'data' => module_exists('block') ? drupal_render($tab['block']) : '',
                    'class' => array(
                        'qt-tab-content',
                        'qt-tab-block-content',
                    ),
                ),
                array(
                    'data' => module_exists('views') ? drupal_render($tab['view']) : '',
                    'class' => array(
                        'qt-tab-content',
                        'qt-tab-view-content',
                    ),
                ),
                array(
                    'data' => drupal_render($tab['node']),
                    'class' => array(
                        'qt-tab-content',
                        'qt-tab-node-content',
                    ),
                ),
                array(
                    'data' => drupal_render($tab['qtabs']),
                    'class' => array(
                        'qt-tab-content',
                        'qt-tab-qtabs-content',
                    ),
                ),
                array(
                    'data' => drupal_render($tab['remove']),
                    'class' => array(
                        'qt-tab-remove',
                    ),
                ),
            ),
            'class' => array(
                'draggable',
            ),
        );
        // Add additional attributes to the row, such as a class for this row.
        if (isset($tab['#attributes'])) {
            $row = array_merge($row, $tab['#attributes']);
        }
        $rows[] = $row;
    }
    $build['quicktab'] = array(
        '#theme' => 'table',
        '#header' => $header,
        '#rows' => $rows,
        '#attributes' => array(
            'id' => 'qt-tablist-table',
        ),
        '#weight' => -1,
    );
    $build['#attached']['css'][] = drupal_get_path('module', 'quicktabs') . '/css/quicktabs-admin.css';
    $build['#attached']['js'][] = drupal_get_path('module', 'quicktabs') . '/js/quicktabs_form.js';
    $output = drupal_render($build);
    return $output;
}