function theme_ds_multigroup_table_multiple in Display Suite 6.2
Same name and namespace in other branches
- 6.3 theme/theme.inc \theme_ds_multigroup_table_multiple()
Theme a multigroup (fieldset).
Parameters
$group:
Return value
bool | string A string representing the rendered fieldset, or FALSE if not content is rendered.
1 string reference to 'theme_ds_multigroup_table_multiple'
- _ds_theme in includes/
ds.registry.inc - Return theme functions.
File
- theme/
theme.inc, line 337 - Theming functions for ds.
Code
function theme_ds_multigroup_table_multiple($group) {
$headers = array();
// Set up row labels from subgroup labels, if applicable
$row_labels = array();
$labels = FALSE;
foreach ($group['rows'] as $row_delta => $row) {
if (isset($row['title'])) {
$row_labels[$row_delta] = $row['title'];
$labels = TRUE;
}
else {
$row_labels[$row_delta] = '';
}
}
foreach ($group['fields'] as $field_name => $field) {
if (isset($labels) && $labels == TRUE) {
$headers[0] = array(
'data' => '',
'class' => $field['class'] . ' ds-subgroup-label content-multigroup-cell-' . str_replace('_', '-', $field_name),
);
}
$label_display = isset($field['labelformat']) ? $field['labelformat'] : 'above';
$headers[] = array(
'data' => $label_display != 'hidden' ? check_plain(t($field['title'])) : '',
'class' => 'content-multigroup-cell-' . str_replace('_', '-', $field_name),
);
}
// Prepare the data
$rows = array();
foreach ($group['rows'] as $row_delta => $row) {
$cells = array();
$empty = TRUE;
// Pick up subgroup labels
if (isset($labels) && $labels == TRUE) {
$cells[0] = array(
'data' => $row_labels[$row_delta],
'class' => $row['class'] . ' content-multigroup-cell-row-label',
);
}
// Regular content
foreach ($row['fields'] as $field_name => $field) {
$cells[] = array(
'data' => $field['view'],
'class' => $field['class'] . ' content-multigroup-cell-' . str_replace('_', '-', $field_name),
);
if (!empty($field['view'])) {
$empty = FALSE;
}
}
// Get the row only if there is at least one non-empty field.
if (!$empty) {
$rows[] = $cells;
}
}
return count($rows) ? theme('table', $headers, $rows) : '';
}