### `#group` property for fieldsets [(issue)](http://drupal.org/node/323112) Fieldsets now have a `#group` property which is a string. Setting that string assigns the fieldset to a group with that name. Grouping fieldset does not change their location in the Form API array but rather only alters how the fieldset is rendered. Fieldsets are also groups themselves, so a fieldset can contain other fieldsets (for rendering purposes only). The name of that group is the name of the fieldset's array key. 'fieldset', '#title' => t('Miscellaneous'), ); $form['settings'] = array( '#type' => 'fieldset', '#title' => t('Settings'), '#group' => 'miscellaneous' ); ?> In this example, the fieldset named `settings` is added to the group named `miscellaneous`. The group members become members of the group element for rendering purposes. To create other form element types which act as groups, the following pattern is suggested: 'pane_slider', '#process' => array('form_process_pane_slider'), ); return $types; } function form_process_pane_slider($element, &$form_state) { // To save us from modifying the existing element and changing its #type, // a new form element is created as a child. The default #process hooks // are called automatically by the form renderer and we don't have to do // that manually. $element['group'] = array( '#type' => 'fieldset', '#theme_wrapper' => '', '#parents' => $element['#parents'], ); return $element; } function example_theme() { return array('pane_slider' => array('arguments' => array('element' => NULL))); } function theme_pane_slider($element) { return '
' . $element['#children'] . '
'; } ?> In this example, a new form element type named `pane_slider` is added in the [`example_elements()` hook](http://api.drupal.org/api/function/hook_elements/7). Using `#theme_wrapper` makes sure that all children are rendered (if the `#theme` function is not overridden) normally. The `#process` function adds a fieldset which is the actual group. However, that fieldset has an empty theme wrapper (meaning that it's not actually wrapped in fieldset HTML code). Also, the `#parents` of that fieldset are altered so that it *believes* that it is its own parent (and therefore obtains the group elements associated with the group). The theme wrapper function `theme_pane_slider()` wraps its sole child (the fieldset) which in turn contains the other fields.