function data_ui_create_form in Data 7
Same name and namespace in other branches
- 6 data_ui/data_ui.admin.inc \data_ui_create_form()
Form callback for create table form.
1 string reference to 'data_ui_create_form'
- data_ui_menu in data_ui/
data_ui.module - Implements hook_menu().
File
- data_ui/
data_ui.admin.inc, line 304 - Admin UI functions.
Code
function data_ui_create_form($form, &$form_state) {
// Multistep form.
if (!isset($form_state['storage']['field_num'])) {
// First form, ask for the database table name.
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Table name'),
'#description' => t('Machine readable name of the table - e.g. "my_table". Must only contain lower case letters and _.'),
'#required' => TRUE,
);
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Table title'),
'#description' => t('Natural name of the table - e.g. "My Table".'),
'#required' => TRUE,
);
$form['field_num'] = array(
'#type' => 'textfield',
'#title' => t('Number of fields'),
'#description' => t('The number of fields this table should contain.'),
'#default_value' => 1,
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Next'),
);
}
else {
// Second form, ask for the database field names.
$form['help']['#markup'] = t('Define the fields of the new table.');
$form['fields'] = array(
'#tree' => TRUE,
);
for ($i = 0; $i < $form_state['storage']['field_num']; $i++) {
$form['fields']['field_' . $i] = _data_ui_field_form(TRUE);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Create'),
);
}
return $form;
}