function data_search_admin_form in Data 6
Same name and namespace in other branches
- 8 data_search/data_search.admin.inc \data_search_admin_form()
- 7 data_search/data_search.admin.inc \data_search_admin_form()
Views handler configuration form.
1 string reference to 'data_search_admin_form'
- data_search_menu in data_search/
data_search.module - Implementation of hook_menu()
File
- data_search/
data_search.admin.inc, line 6
Code
function data_search_admin_form(&$form_state, $table) {
drupal_set_title(check_plain($table
->get('title')));
$schema = $table
->get('table_schema');
$meta = $table
->get('meta');
$form = array();
if (count($schema['primary key']) != 1) {
drupal_set_message(t('Only tables with a single-field primary key can be indexed.'), 'error');
return $form;
}
// Keep table.
$form['#table'] = $table;
// Existing fields.
$form['fields'] = array(
'#tree' => TRUE,
);
if (isset($schema['fields'])) {
$enabled_fields = data_search_get_fields($table);
foreach ($schema['fields'] as $field_name => $field) {
$form['fields'][$field_name] = array();
$form['fields'][$field_name]['name'] = array(
'#value' => $field_name,
);
$form['fields'][$field_name]['search'] = array(
'#type' => 'checkbox',
'#default_value' => in_array($field_name, $enabled_fields),
);
}
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}