You are here

function theme_ds_group_fieldset in Display Suite 6.2

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

Theme a group (fieldset).

Parameters

string $field The field to theme.:

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

File

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

Code

function theme_ds_group_fieldset($field) {
  $add_js = FALSE;
  $class = $field['class'];
  $variation = array_pop(explode('_', $field['theme']));
  switch ($variation) {
    case 'collapsible':
      $add_js = TRUE;
      $class .= ' collapsible';
      break;
    case 'collapsed':
      $add_js = TRUE;
      $class .= ' collapsible collapsed';
      break;
    default:
      break;
  }

  // Add js.
  if ($add_js == TRUE) {
    drupal_add_js('misc/collapse.js');
  }

  // Set a legend if a field title exists
  $legend = NULL;
  if (!empty($field['title'])) {
    $legend = '<legend>' . $field['title'] . '</legend>';
  }
  return '<fieldset class="group ' . $class . '">' . $legend . $field['content'] . '</fieldset>';
}