You are here

function theme_content_multigroup_display_table_single in Content Construction Kit (CCK) 6.3

Theme a multigroup in 'table-single' format.

Each subgroup has its own table row with a single cell for all fields. No output is generated if all fields are empty.

File

modules/content_multigroup/content_multigroup.node_view.inc, line 187
Implementation of node view functions for content multigroup.

Code

function theme_content_multigroup_display_table_single($element) {
  $headers = array();
  $rows = array();
  foreach (element_children($element) as $delta) {
    $items = array();
    foreach ($element['#fields'] as $field_name => $field) {
      $item = drupal_render($element[$delta][$field_name]);
      if (!empty($item)) {
        $items[] = $item;
      }
    }
    if (!empty($items)) {
      if (!empty($element[$delta]['#title'])) {
        array_unshift($items, '<label class="content-multigroup">' . $element[$delta]['#title'] . ':</label>');
      }
      $rows[] = array(
        'data' => array(
          implode("\n", $items),
        ),
        'class' => $element[$delta]['#attributes']['class'],
      );
    }
  }
  return count($rows) ? theme('table', $headers, $rows, $element['#attributes']) : '';
}