function table_trash_admin_global_settings_form in Table Trash 7
Menu callback for global settings configuration.
1 string reference to 'table_trash_admin_global_settings_form'
- table_trash_menu in ./
table_trash.module - Implements hook_menu().
File
- ./
table_trash.admin.inc, line 13 - table_trash.admin.inc
Code
function table_trash_admin_global_settings_form($form, &$form_state) {
ctools_include('export');
// Retain tree-hierarchy in values, prevent the form from being flattened.
$form['#tree'] = TRUE;
$form['global_settings']['#attached']['css'][] = drupal_get_path('module', 'table_trash') . '/css/table_trash.admin.css';
$global_settings = variable_get('table_trash_global_settings', array());
$form['global_settings']['load_from'] = array(
'#type' => 'select',
'#title' => t('Load library from:'),
'#options' => array(
'module' => t('Module'),
'cdn' => t('Datatables CDN'),
'alternate' => t('Alternate CDN'),
),
'#default_value' => isset($global_settings['load_from']) ? $global_settings['load_from'] : 'module',
);
$form['global_settings']['alternate_cdn_js'] = array(
'#type' => 'textfield',
'#title' => t('Alternate js CDN url.'),
'#maxlength' => 300,
'#default_value' => isset($global_settings['alternate_cdn_js']) ? $global_settings['alternate_cdn_js'] : '',
'#description' => t('An alternate cdn url. Note that these plugins are required for full functionality. JSZip, pdfmake, DataTables, AutoFill, Buttons, Column visibility, HTML5 export, Print view, ColReorder, FixedColumns, FixedHeader, KeyTable, Responsive, RowReorder, Scroller, Select.'),
'#states' => array(
'visible' => array(
':input[name="global_settings[load_from]"]' => array(
'value' => 'alternate',
),
),
'required' => array(
':input[name="global_settings[load_from]"]' => array(
'value' => 'alternate',
),
),
),
);
$form['global_settings']['alternate_cdn_css'] = array(
'#type' => 'textfield',
'#title' => t('Alternate css CDN url.'),
'#maxlength' => 300,
'#default_value' => isset($global_settings['alternate_cdn_css']) ? $global_settings['alternate_cdn_css'] : '',
'#description' => t('An alternate cdn url. Note that these plugins are required for full functionality. JSZip, pdfmake, DataTables, AutoFill, Buttons, Column visibility, HTML5 export, Print view, ColReorder, FixedColumns, FixedHeader, KeyTable, Responsive, RowReorder, Scroller, Select.'),
'#states' => array(
'visible' => array(
':input[name="global_settings[load_from]"]' => array(
'value' => 'alternate',
),
),
'required' => array(
':input[name="global_settings[load_from]"]' => array(
'value' => 'alternate',
),
),
),
);
$form['global_settings']['responsive'] = array(
'#type' => 'markup',
'#prefix' => '<div id="global-settings-responsive">',
'#suffix' => '</div>',
);
$form['global_settings']['responsive']['breakpoint_phone'] = array(
'#type' => 'textfield',
'#size' => 4,
'#maxlength' => 4,
'#field_suffix' => t('px'),
'#title' => t('Responsive width breakpoint for phone sized windows'),
'#default_value' => isset($global_settings['responsive']['breakpoint_phone']) ? $global_settings['responsive']['breakpoint_phone'] : '',
'#description' => t('The default width for phones is %px.', array(
'%px' => TABLE_TRASH_DEFAULT_BREAKPOINT_PHONE,
)),
);
$form['global_settings']['responsive']['breakpoint_tablet'] = array(
'#type' => 'textfield',
'#size' => 4,
'#maxlength' => 4,
'#field_suffix' => t('px'),
'#title' => t('Responsive width breakpoint for tablet sized windows'),
'#default_value' => isset($global_settings['responsive']['breakpoint_tablet']) ? $global_settings['responsive']['breakpoint_tablet'] : '',
'#description' => t('The default width for tablets is %px.', array(
'%px' => TABLE_TRASH_DEFAULT_BREAKPOINT_TABLET,
)),
);
$form['global_settings']['use_datatables_css'] = array(
'#type' => 'checkbox',
'#title' => t('Add native DataTables styling'),
'#default_value' => isset($global_settings['use_datatables_css']) ? $global_settings['use_datatables_css'] : TRUE,
);
$form['global_settings']['use_table_trash_css'] = array(
'#type' => 'checkbox',
'#title' => t('Add Table Trash styling'),
'#default_value' => isset($global_settings['use_table_trash_css']) ? $global_settings['use_table_trash_css'] : TRUE,
);
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
$form['#theme'] = 'system_settings_form';
return $form;
}