You are here

function theme_views_showcase_checkbox_table in Views Showcase 7

Same name and namespace in other branches
  1. 6.2 views_showcase.module \theme_views_showcase_checkbox_table()

Theming the style options form to render the table with the checkboxes used to choose where to display each field.

2 theme calls to theme_views_showcase_checkbox_table()
views_showcase_plugin_style_showcase::options_form in plugins/views_showcase_plugin_style_showcase.inc
Render the given style.
views_showcase_style_plugin::options_form in ./views_showcase_style_plugin.inc
Provide a form to edit options for this plugin.

File

./views_showcase.module, line 166
The implementation of Views Showcase module.

Code

function theme_views_showcase_checkbox_table($element) {

  //Build the header of the table to be rendered
  $header = array(
    t('Field ID'),
    t('Big Box'),
    t('Navigation Box'),
    t('Link to Anchor'),
  );
  $element = reset($element);

  //Build the content of the table
  foreach ($element['navigation_box_field']['#options'] as $field_name => $field) {
    $row = array();

    //First Column the name of the field
    $row[] = $field;

    //Emptying the labels so that they aren't rendered for each checkbox in the table
    $element['big_box_field'][$field_name]['#title'] = '';
    $element['navigation_box_field'][$field_name]['#title'] = '';
    $element['link_anchor_field'][$field_name]['#title'] = '';

    //Now using the rendered HTML of each field and add it to the table
    $row[] = drupal_render($element['big_box_field'][$field_name]);
    $row[] = drupal_render($element['navigation_box_field'][$field_name]);
    $row[] = drupal_render($element['link_anchor_field'][$field_name]);

    //Stack all rows in one array
    $rows[] = $row;
  }

  //Render as an HTML table and return
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
}