You are here

function theme_ds_multigroup_comma_separated in Display Suite 6.2

Same name and namespace in other branches
  1. 6.3 theme/theme.inc \theme_ds_multigroup_comma_separated()

Theme a multigroup as a comma separated list

Parameters

string $group: The multigroup to theme.

Return value

bool | string A string representing the rendered fieldset, or FALSE if not content is rendered.

1 string reference to 'theme_ds_multigroup_comma_separated'
_ds_theme in includes/ds.registry.inc
Return theme functions.

File

theme/theme.inc, line 466
Theming functions for ds.

Code

function theme_ds_multigroup_comma_separated($group) {
  $output = '';
  foreach ($group['rows'] as $row) {
    $row_content = '';
    $row_output = '';
    $n = count($row['fields']);
    $count = 1;
    foreach ($row['fields'] as $field) {
      if (!empty($field['content'])) {
        $class = !empty($field['class']) ? ' ' . $field['class'] : '';
        $row_content .= '<span class="field-item ' . $class . '">';
        if ($field['labelformat'] == 'inline') {
          $row_content .= '<span class="field-label-inline-first">' . $field['title'] . ': </span>';
        }
        $row_content .= $field['content'] . '</span>';
        if ($count != $n) {
          $row_content .= ', ';
        }
      }
      $count++;
    }

    // Set a legend if a field title exists
    if (!empty($row_content)) {
      $output .= '<div class="' . $row['class'] . '">';
      if (!empty($row['title'])) {
        $row_output = theme('ds_subgroup_label', $row['title']);
      }
      $row_output .= $row_content;
      $output .= $row_output;
      $output .= '</div>';
    }
  }
  return $output;
}