You are here

function _data_ui_field_form in Data 7

Same name and namespace in other branches
  1. 6 data_ui/data_ui.admin.inc \_data_ui_field_form()

Helper function that generates a form snippet for defining a field.

2 calls to _data_ui_field_form()
data_ui_create_form in data_ui/data_ui.admin.inc
Form callback for create table form.
data_ui_edit_form in data_ui/data_ui.admin.inc
Form callback for editing a table.

File

data_ui/data_ui.admin.inc, line 1209
Admin UI functions.

Code

function _data_ui_field_form($required = FALSE) {
  $form = array();
  $form['#tree'] = TRUE;
  $form['name'] = array(
    '#type' => 'textfield',
    '#size' => 20,
    '#required' => $required,
  );
  $form['label'] = array(
    '#type' => 'textfield',
    '#size' => 20,
  );
  $form['type'] = array(
    '#type' => 'select',
    '#options' => data_get_field_types(),
  );
  $form['size'] = array(
    '#type' => 'select',
    '#options' => data_get_field_sizes(),
  );
  $form['unsigned'] = array(
    '#type' => 'checkbox',
  );
  $form['index'] = array(
    '#type' => 'checkbox',
  );
  $form['primary'] = array(
    '#type' => 'checkbox',
  );
  return $form;
}