You are here

function theme_nd_buildmodes_matrix_form in Node displays 6

Theme build modes matrix form.

File

includes/nd.buildmodes.inc, line 114
Manage build modes.

Code

function theme_nd_buildmodes_matrix_form($form) {
  $output = '';

  // Header.
  $header = array(
    0 => '',
  );
  foreach ($form['#build_modes'] as $key => $mode) {
    $header[] = $mode['title'];
  }

  // Checkboxes.
  $rows = array();
  foreach ($form['#content_types'] as $key => $type) {
    $row = array();
    $row[] = array(
      'data' => $type->name,
    );
    foreach ($form['#build_modes'] as $bkey => $mode) {
      $row[] = array(
        'data' => drupal_render($form['exclude'][$key][$key . '-' . $bkey]),
      );
    }
    $rows[] = $row;
  }

  // Theme as table.
  $table = theme('table', $header, $rows);
  $table .= drupal_render($form['exclude']['submit']);
  $fieldset = array(
    '#title' => t('Exclude matrix'),
    '#description' => t('Toggle per content type which build modes you want to exclude from rendering by Node Displays. <br />The "Toggle all" checkbox will exclude/include all build modes at once.'),
    '#children' => $table,
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $output = theme('fieldset', $fieldset);
  $output .= drupal_render($form);
  return $output;
}