Same name and namespace in other branches
  1. 7.x-2.x includes/admin.inc \theme_quicktabs_admin_form_tabs()

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 dans ./quicktabs.admin.inc
The main section of admin page.

Fichier

./quicktabs.admin.inc, line 356

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',
        );
        // tab settings fields
        $tab_fields = 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',
                ),
            ),
        );
        // content plugins
        $content_plugins = '';
        foreach ($tab['type']['#options'] as $content_provider) {
            $tab[$content_provider]['#prefix'] = '<div class="qt-tab-options-form qt-tab-' . $content_provider . '-options-form">';
            $tab[$content_provider]['#suffix'] = '</div>';
            $content_plugins .= drupal_render($tab[$content_provider]);
        }
        $tab_fields[] = array(
            'data' => $content_plugins,
        );
        $tab_fields[] = array(
            'data' => drupal_render($tab['remove']),
            'class' => array(
                'qt-tab-remove',
            ),
        );
        // Build the table row.
        $row = array(
            'data' => $tab_fields,
            '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;
}