You are here

function theme_views_pdf_plugin_style_table in Views PDF 7.3

Same name and namespace in other branches
  1. 8 views_pdf.admin.inc \theme_views_pdf_plugin_style_table()
  2. 6 views_pdf.admin.inc \theme_views_pdf_plugin_style_table()
  3. 7 views_pdf.admin.inc \theme_views_pdf_plugin_style_table()
  4. 7.2 views_pdf.admin.inc \theme_views_pdf_plugin_style_table()

Theme function to style the table UI in the Table Style Settings pages in the view editing form.

File

./views_pdf.admin.inc, line 13
Theme function for enhence the views admin interface vor PDF options.

Code

function theme_views_pdf_plugin_style_table($variables) {
  $form = $variables['form'];
  $output = drupal_render($form['description_markup']);
  $defheader = array(
    '',
    t('Header Style'),
    t('Body Style'),
    '',
  );
  $header = array(
    t('Field'),
    t('Header Style'),
    t('Body Style'),
    t('Width'),
    t('Hide if Empty'),
  );

  //$output .= print_r($variables, 1);
  $defrows = $rows = array();
  foreach (element_children($form['info']) as $id) {
    if ($id == '_default_') {
      $defrow = array();
      $defrow[] = array(
        'width' => '15%',
      );
      $defrow[] = array(
        'data' => drupal_render($form['info'][$id]['header_style']),
        'width' => '30%',
      );
      $defrow[] = array(
        'data' => drupal_render($form['info'][$id]['body_style']),
        'width' => '30%',
      );
      $defrow[] = array(
        'width' => '25%',
      );
      $defrows[] = $defrow;
    }
    else {
      $row = array();
      $row[] = array(
        'data' => drupal_render($form['info'][$id]['name']),
        'width' => '15%',
      );
      $row[] = array(
        'data' => drupal_render($form['info'][$id]['header_style']),
        'width' => '30%',
      );
      $row[] = array(
        'data' => drupal_render($form['info'][$id]['body_style']),
        'width' => '30%',
      );
      $row[] = array(
        'data' => drupal_render($form['info'][$id]['position']),
        'width' => '15%',
      );
      $row[] = array(
        'data' => drupal_render($form['info'][$id]['empty']),
        'width' => '10%',
      );
      $rows[] = $row;
    }
  }
  $table_vars = array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(),
    'caption' => '',
    'colgroups' => array(),
    'sticky' => 0,
    'empty' => '',
  );
  $fs_columns = array(
    'element' => array(
      '#title' => t('Column specifics'),
      '#attributes' => array(
        'class' => array(
          'collapsible',
          'collapsed',
        ),
      ),
      '#children' => theme_table($table_vars),
    ),
  );

  // Use the table theme to output just a heading in consistent style.
  $table_vars['header'] = array(
    'data' => t('Column defaults'),
  );
  $table_vars['rows'] = array();
  $output .= theme_table($table_vars);

  // Table of header and body defaults.
  $table_vars['header'] = $defheader;
  $table_vars['rows'] = $defrows;
  $output .= theme_table($table_vars);

  // Table of header and body specifics in a fieldset.
  $output .= theme_fieldset($fs_columns);

  // The rest of the form.
  $output .= drupal_render_children($form);
  return $output;
}