You are here

function theme_fieldgroup_fieldset in Content Construction Kit (CCK) 6.2

Same name and namespace in other branches
  1. 6.3 modules/fieldgroup/fieldgroup.module \theme_fieldgroup_fieldset()

Format a fieldgroup using a 'fieldset'.

Derived from core's theme_fieldset, with no output if the content is empty.

File

modules/fieldgroup/fieldgroup.module, line 850
Create field groups for CCK fields.

Code

function theme_fieldgroup_fieldset($element) {
  if (empty($element['#children']) && empty($element['#value'])) {
    return '';
  }
  if ($element['#collapsible']) {
    drupal_add_js('misc/collapse.js');
    if (!isset($element['#attributes']['class'])) {
      $element['#attributes']['class'] = '';
    }
    $element['#attributes']['class'] .= ' collapsible';
    if ($element['#collapsed']) {
      $element['#attributes']['class'] .= ' collapsed';
    }
  }
  return '<fieldset' . drupal_attributes($element['#attributes']) . '>' . ($element['#title'] ? '<legend>' . $element['#title'] . '</legend>' : '') . (isset($element['#description']) && $element['#description'] ? '<div class="description">' . $element['#description'] . '</div>' : '') . (!empty($element['#children']) ? $element['#children'] : '') . (isset($element['#value']) ? $element['#value'] : '') . "</fieldset>\n";
}