You are here

function theme_views_ui_style_d3_options_form in d3.js 7

Theme the form for the table style plugin.

File

modules/d3_views/d3_views.module, line 65
D3 views module file.

Code

function theme_views_ui_style_d3_options_form($variables) {
  $form = $variables['form'];
  $output = drupal_render($form['library']);
  $required =& $form['fields'];

  // Loop over each type of dataset, default will be 'rows'.
  foreach (element_children($required) as $id) {
    $header = array();
    $rows = array();

    // This row does not have sub fields.
    if (!empty($required[$id]['field'])) {
      $rows[] = _theme_views_ui_style_d3_options_form_row($required[$id], $header);
    }
    else {

      // Each of these sub fields another mapping.
      foreach (element_children($required[$id]) as $field_name) {
        $header = array();
        $rows[] = _theme_views_ui_style_d3_options_form_row($required[$id][$field_name], $header);
      }
    }

    // Each data array has an option to convert it to a numeric array.
    $rows[] = array(
      array(
        'data' => drupal_render($form['numeric'][$id]),
        'colspan' => count($header),
      ),
    );
    $required['table' . $id] = array(
      '#caption' => isset($required[$id]['#caption']) ? $required[$id]['#caption'] : FALSE,
      '#theme' => 'table',
      '#rows' => $rows,
      '#header' => $header,
    );
  }
  $output .= drupal_render($required) . drupal_render_children($form);
  return $output;
}