You are here

function theme_data_ui_field_config_form in Data 7

Theme a generic form of field settings as a table.

The form must have the following structure:

  • 'fields': A nested array of form elements, grouped first by table field and then by configuration setting. Thus, the form element for a single configuration for a field is at $form['fields'][FIELDNAME][SETTING], and should be repeated for all fields.
  • '#header': An array of strings for the table header.

@todo: convert other form builders to use this.

File

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

Code

function theme_data_ui_field_config_form($variables) {
  $form = $variables['form'];

  // Format existing fields.
  $rows = array();
  foreach (element_children($form['fields']) as $field_element) {
    $row = array();
    foreach (element_children($form['fields'][$field_element]) as $setting_element) {
      $row[] = drupal_render($form['fields'][$field_element][$setting_element]);
    }
    $rows[] = $row;
  }
  $output = theme('table', array(
    'header' => $form['#header'],
    'rows' => $rows,
  ));
  $output .= drupal_render_children($form);
  return $output;
}