function data_ui_views_form in Data 6
Same name and namespace in other branches
- 7 data_ui/data_ui.admin.inc \data_ui_views_form()
Views handler configuration form.
1 string reference to 'data_ui_views_form'
- data_ui_menu in data_ui/
data_ui.module - Implementation of hook_menu()
File
- data_ui/
data_ui.admin.inc, line 678 - Admin UI functions.
Code
function data_ui_views_form(&$form_state, $table) {
drupal_set_title(check_plain($table
->get('title')));
module_load_include('inc', 'data', 'data.views');
$schema = $table
->get('table_schema');
$meta = $table
->get('meta');
$form = array();
// Keep table.
$form['#table'] = $table;
// Existing fields.
$form['fields'] = array(
'#tree' => TRUE,
);
if (isset($schema['fields'])) {
foreach ($schema['fields'] as $field_name => $field) {
$form['fields'][$field_name] = array();
$form['fields'][$field_name]['name'] = array(
'#value' => check_plain($field_name),
);
$form['fields'][$field_name]['views_field_handler'] = array(
'#type' => 'select',
'#options' => data_get_views_handler_options('field'),
'#default_value' => data_get_views_handler('field', $table, $field_name),
);
$form['fields'][$field_name]['views_filter_handler'] = array(
'#type' => 'select',
'#options' => data_get_views_handler_options('filter'),
'#default_value' => data_get_views_handler('filter', $table, $field_name),
);
$form['fields'][$field_name]['views_argument_handler'] = array(
'#type' => 'select',
'#options' => data_get_views_handler_options('argument'),
'#default_value' => data_get_views_handler('argument', $table, $field_name),
);
$form['fields'][$field_name]['views_sort_handler'] = array(
'#type' => 'select',
'#options' => data_get_views_handler_options('sort'),
'#default_value' => data_get_views_handler('sort', $table, $field_name),
);
}
}
$form['notice'] = array(
'#type' => 'markup',
'#value' => '<p>' . t('Note that not every handler will make sense or function correctly with every type of field.') . '</p>',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}