function _quicktabs_form in Quick Tabs 6.3
Same name and namespace in other branches
- 5 quicktabs.module \_quicktabs_form()
- 6 quicktabs.module \_quicktabs_form()
- 6.2 includes/admin.inc \_quicktabs_form()
- 7.3 quicktabs.admin.inc \_quicktabs_form()
- 7.2 includes/admin.inc \_quicktabs_form()
1 call to _quicktabs_form()
- quicktabs_form in includes/
admin.inc - Build the quicktab creation and edit form.
File
- includes/
admin.inc, line 228
Code
function _quicktabs_form($details, $quicktabs) {
$form['#tree'] = TRUE;
$delta = $details['delta'];
$form['weight'] = array(
'#type' => 'weight',
'#default_value' => isset($details['weight']) ? $details['weight'] : $delta - 100,
'#delta' => 100,
);
$form['title'] = array(
'#type' => 'textfield',
'#size' => '10',
'#default_value' => isset($details['title']) ? $details['title'] : '',
);
$tabtypes = array(
'block' => t('Block'),
'node' => t('Node'),
'qtabs' => t('QTab'),
'callback' => t('QT Callback'),
);
if (module_exists('views')) {
$views = quicktabs_get_views();
$views_keys = array_keys($views);
$tabtypes['view'] = t('View!translate_as_list_of_content', array(
'!translate_as_list_of_content' => '',
));
$selected_view = isset($details['vid']) ? $details['vid'] : (isset($views_keys[0]) ? $views_keys[0] : '');
$form['view']['vid'] = array(
'#type' => 'select',
'#options' => $views,
'#default_value' => $selected_view,
'#title' => t('Select a view'),
'#ahah' => array(
'path' => 'quicktabs/ahah',
'wrapper' => 'quicktabs-tabs',
'method' => 'replace',
'event' => 'change',
),
);
$form['view']['display'] = array(
'#type' => 'select',
'#title' => 'display',
'#options' => _quicktabs_get_views_displays($selected_view),
'#default_value' => isset($details['display']) ? $details['display'] : '',
);
$form['view']['args'] = array(
'#type' => 'textfield',
'#title' => 'arguments',
'#size' => '40',
'#required' => FALSE,
'#default_value' => isset($details['args']) ? $details['args'] : '',
'#description' => t('Additional arguments to send to the view as if they were part of the URL in the form of arg1/arg2/arg3. You may use %0, %1, ..., %N to grab arguments from the URL.'),
);
$form['view']['get_displays'] = array(
'#type' => 'submit',
'#value' => 'vdisp_' . $delta,
'#submit' => array(
'qt_get_displays_submit',
),
);
}
$form['block']['bid'] = array(
'#type' => 'select',
'#options' => quicktabs_get_blocks(),
'#default_value' => isset($details['bid']) ? $details['bid'] : '',
'#title' => t('Select a block'),
);
$form['block']['hide_title'] = array(
'#type' => 'checkbox',
'#title' => t('Hide the title of this block'),
'#default_value' => isset($details['hide_title']) ? $details['hide_title'] : 1,
);
$form['node']['nid'] = array(
'#type' => 'textfield',
'#title' => t('Node'),
'#description' => t('The node ID of the node.'),
'#maxlength' => 10,
'#size' => 20,
'#default_value' => isset($details['nid']) ? $details['nid'] : '',
);
$form['node']['teaser'] = array(
'#type' => 'checkbox',
'#title' => t('Teaser view'),
'#default_value' => isset($details['teaser']) ? $details['teaser'] : 0,
);
$form['node']['hide_title'] = array(
'#type' => 'checkbox',
'#title' => t('Hide the title of this node'),
'#default_value' => isset($details['hide_title']) ? $details['hide_title'] : 1,
);
$tab_options = array();
foreach (quicktabs_get_all_quicktabs() as $machine_name => $tab) {
// Do not offer the option to put a tab inside itself.
if ($quicktabs['machine_name'] != $machine_name) {
$tab_options[$machine_name] = $tab['title'];
}
}
$form['qtabs']['machine_name'] = array(
'#type' => 'select',
'#title' => t('Quicktab'),
'#description' => t('The quicktab block to put inside this tab.') . ' ' . t('Different styles may not work when putting an ajax quicktab inside ajax quicktab.'),
'#default_value' => isset($details['machine_name']) ? $details['machine_name'] : '',
'#options' => $tab_options,
);
$form['callback']['path'] = array(
'#type' => 'textfield',
'#title' => t('Callback Path'),
'#description' => t('The path to your custom menu callback.') . ' ' . t('This should be a special menu callback that can deliver content specially for use in Quicktabs.'),
'#size' => 20,
'#default_value' => isset($details['path']) ? $details['path'] : '',
);
$form['type'] = array(
'#type' => 'radios',
'#options' => $tabtypes,
'#default_value' => isset($details['type']) ? $details['type'] : 'block',
);
$form['remove'] = array(
'#type' => 'submit',
'#prefix' => '<div>',
'#suffix' => '<label for="edit-remove">' . t('Delete') . '</label></div>',
'#value' => 'remove_' . $delta,
'#attributes' => array(
'class' => 'delete-tab',
'title' => t('Click here to delete this tab.'),
),
'#submit' => array(
'qt_remove_tab_submit',
),
'#ahah' => array(
'path' => 'quicktabs/ahah',
'wrapper' => 'quicktabs-tabs',
'method' => 'replace',
'effect' => 'fade',
),
);
return $form;
}