function tablesorter_form in Tablesorter 7
Same name and namespace in other branches
- 7.2 tablesorter.module \tablesorter_form()
Configuration form.
1 string reference to 'tablesorter_form'
- tablesorter_menu in ./
tablesorter.module - Implements hook_menu().
File
- ./
tablesorter.module, line 93 - Tablesorter.
Code
function tablesorter_form($form, &$form_state) {
// Tablesorter loading options.
$page_options = array(
'page_enable' => t('Load on all pages of site.'),
'page_disable' => t('Load on the listed pages.'),
);
$form['tablesorter_page_init_action'] = array(
'#type' => 'radios',
'#options' => $page_options,
'#title' => t('Enable tablesorter on specific pages'),
'#default_value' => variable_get('tablesorter_page_init_action', 'page_enable'),
);
$form['tablesorter_page_list'] = array(
'#type' => 'textarea',
'#title' => t('Pages'),
'#description' => t('List one page per line as Drupal paths. The * character is a wildcard. Example paths are "node/add/page" and "node/add/*". Use <front> to match the front page.'),
'#default_value' => variable_get('tablesorter_page_list', ''),
'#states' => array(
'invisible' => array(
':input[name="tablesorter_page_init_action"]' => array(
'value' => 'page_enable',
),
),
),
);
// Add themes.
// Get theme options from the directory.
$options = array();
$path = libraries_get_path('tablesorter');
$themes = scandir($path . '/css');
if ($themes) {
foreach ($themes as $theme) {
$theme_array = explode('.', $theme);
if ($theme_array[0] == 'theme' && isset($theme_array[2]) && $theme_array[2] == 'min') {
$options[$theme_array[1]] = ucfirst($theme_array[1]);
}
}
}
$form['tablesorter_theme'] = array(
'#type' => 'select',
'#title' => t('Select Theme'),
'#options' => $options,
'#default_value' => variable_get('tablesorter_theme'),
'#description' => t('Set the theme for header.'),
'#empty_option' => t('System Theme'),
);
// Add widgets.
$widgets = array(
'zebra' => t('Zebra striping'),
);
$form['tablesorter_widgets'] = array(
'#type' => 'checkboxes',
'#multiple' => 'multiple',
'#options' => $widgets,
'#title' => t('Add widgets'),
'#default_value' => variable_get('tablesorter_widgets', ''),
);
// Options for the zebra widget.
$form['tablesorter_zebra_odd_class'] = array(
'#type' => 'textfield',
'#title' => t('Odd row class'),
'#description' => t("Select the class added to odd rows. Defaults to 'odd'"),
'#default_value' => variable_get('tablesorter_zebra_odd_class', 'odd'),
);
$form['tablesorter_zebra_even_class'] = array(
'#type' => 'textfield',
'#title' => t('Even row class'),
'#description' => t("Select the class added to even rows. Defaults to 'even'"),
'#default_value' => variable_get('tablesorter_zebra_even_class', 'even'),
);
// Add a submit handler.
$form['#submit'][] = '_tablesorter_form_submit';
return system_settings_form($form);
}