You are here

function theme_ds_multigroup_first_label in Display Suite 6.2

Theme a multigroup so the first field is a label for other fields

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_first_label'
_ds_theme in includes/ds.registry.inc
Return theme functions.

File

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

Code

function theme_ds_multigroup_first_label($group) {
  $output = '';
  foreach ($group['rows'] as $row_index => $row) {
    $row_content = '';
    $row_output = '';
    $field_index = 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_index == 1) {
          $row_content .= '<span class="field-label-inline-first">' . $field['content'] . ': </span>';
        }
        else {
          $row_content .= $field['content'];
        }
        $row_content .= '</span>';
      }
      $field_index++;
    }

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