Same name in other branches
  1. 7.x-3.x quicktabs.admin.inc \quicktabs_form()
  2. 8.x-1.x quicktabs.admin.inc \quicktabs_form()

Build the quicktab creation and edit form.

2 string references to 'quicktabs_form'
quicktabs_clone in includes/admin.inc
Clone QuickTabs.
quicktabs_menu in ./quicktabs.module
Implements hook_menu().

File

includes/admin.inc, line 154

Code

function quicktabs_form($form, &$form_state, $formtype, $quicktab = NULL) {
    if (!isset($quicktab)) {
        $quicktab = new stdClass();
    }
    $form = _quicktabs_admin_main_form($form_state, $quicktab);
    if (empty($quicktab->tabs)) {
        $quicktab->tabs = array(
            0 => array(),
            1 => array(),
        );
    }
    if (isset($form_state['num_tabs']) && $form_state['num_tabs'] > count($quicktab->tabs)) {
        $quicktab->tabs[] = array();
    }
    $form_state['num_tabs'] = count($quicktab->tabs);
    if (isset($form_state['to_remove'])) {
        unset($quicktab->tabs[$form_state['to_remove']]);
        unset($form_state['to_remove']);
        $form_state['num_tabs']--;
    }
    $tab_titles = array();
    // Add current tabs to the form.
    foreach ($quicktab->tabs as $delta => $tab) {
        $tab['delta'] = $delta;
        $form['qt_wrapper']['tabs'][$delta] = _quicktabs_form($tab);
        if (isset($tab['title'])) {
            $tab_titles[$delta] = $tab['title'];
        }
    }
    $form['default_tab'] = array(
        '#type' => 'select',
        '#title' => t('Default tab'),
        '#options' => $tab_titles,
        '#default_value' => isset($quicktab->default_tab) ? $quicktab->default_tab : 0,
        '#access' => !empty($tab_titles),
        '#weight' => -5,
    );
    return $form;
}