Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1098
diff -u -p -r1.1098 common.inc
--- includes/common.inc 5 Feb 2010 21:15:43 -0000 1.1098
+++ includes/common.inc 5 Feb 2010 23:14:51 -0000
@@ -5695,6 +5695,9 @@ function drupal_common_theme() {
'vertical_tabs' => array(
'render element' => 'element',
),
+ 'vertical_tabs_fieldset' => array(
+ 'render element' => 'element',
+ ),
'container' => array(
'render element' => 'element',
),
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.430
diff -u -p -r1.430 form.inc
--- includes/form.inc 4 Feb 2010 03:34:20 -0000 1.430
+++ includes/form.inc 5 Feb 2010 23:14:53 -0000
@@ -1964,6 +1964,36 @@ function theme_fieldset($variables) {
}
/**
+ * Theme a fieldset form element wrapped for a vertical tab group.
+ *
+ * This is an internal function that is added by form_pre_render_vertical_tabs()
+ * to the #theme_wrapper attribute of fieldsets that are inside vertical tab groups.
+ *
+ * @param $variables
+ * An associative array containing:
+ * - element: An associative array containing the properties of the element.
+ * Properties used: #attributes, #children, #collapsed, #collapsible,
+ * #description, #id, #title, #value.
+ *
+ * * @return
+ * A themed HTML string representing the group of items.
+ */
+function theme_vertical_tabs_fieldset($variables) {
+ $element = $variables['element'];
+
+ $output = '
';
+ if (isset($element['#content_prefix'])) {
+ $output .= $element['#content_prefix'];
+ }
+ $output .= theme('fieldset', $variables);
+ if (isset($element['#content_suffix'])) {
+ $output .= $element['#content_suffix'];
+ }
+ $output .= '
';
+ return $output;
+}
+
+/**
* Theme a radio button form element.
*
* @param $variables
@@ -2717,6 +2747,40 @@ function form_process_vertical_tabs($ele
}
/**
+ * Adds theme wrapper to fieldsets contained in a vertical tab group
+ * and moves prefix or suffix attributes to be handled by the theme wrapper
+ * instead of drupal_render().
+ *
+ * @param $element
+ * An associative array containing the properties and children of the
+ * vertical tab group.
+ *
+ * @return
+ * The modified element with all group members.
+ */
+function form_pre_render_vertical_tabs($element) {
+ $parents = implode('][', $element['group']['#parents']);
+ $children = element_children($element['group']['#groups'][$parents]);
+ if (!empty($children)) {
+ foreach ($children as $key) {
+ $child = $element['group']['#groups'][$parents][$key];
+ if (is_array($child) && $child['#type'] === 'fieldset') {
+ if (isset($child['#prefix'])) {
+ $element['group']['#groups'][$parents][$key]['#content_prefix'] = $child['#prefix'];
+ unset($element['group']['#groups'][$parents][$key]['#prefix']);
+ }
+ if (isset($child['#suffix'])) {
+ $element['group']['#groups'][$parents][$key]['#content_suffix'] = $child['#suffix'];
+ unset($element['group']['#groups'][$parents][$key]['#suffix']);
+ }
+ $element['group']['#groups'][$parents][$key]['#theme_wrappers'][] = 'vertical_tabs_fieldset';
+ }
+ }
+ }
+ return $element;
+}
+
+/**
* Makes the element's children fieldsets be vertical tabs.
*
* @param $variables
Index: misc/vertical-tabs.css
===================================================================
RCS file: /cvs/drupal/drupal/misc/vertical-tabs.css,v
retrieving revision 1.6
diff -u -p -r1.6 vertical-tabs.css
--- misc/vertical-tabs.css 31 May 2009 00:51:41 -0000 1.6
+++ misc/vertical-tabs.css 5 Feb 2010 23:14:53 -0000
@@ -15,12 +15,12 @@ div.vertical-tabs ul.vertical-tabs-list
left: -15em;
float: left;
}
-div.vertical-tabs .vertical-tabs-panes fieldset.vertical-tabs-pane {
+div.vertical-tabs .vertical-tabs-panes div.vertical-tabs-pane {
margin: 0 !important;
padding: 0 1em;
border: 0;
}
-div.vertical-tabs .vertical-tabs-panes fieldset.vertical-tabs-pane legend {
+div.vertical-tabs .vertical-tabs-panes div.vertical-tabs-pane legend {
display: none;
}
Index: misc/vertical-tabs.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/vertical-tabs.js,v
retrieving revision 1.7
diff -u -p -r1.7 vertical-tabs.js
--- misc/vertical-tabs.js 31 Aug 2009 05:51:08 -0000 1.7
+++ misc/vertical-tabs.js 5 Feb 2010 23:14:53 -0000
@@ -23,13 +23,13 @@ Drupal.behaviors.verticalTabs = {
$(this).wrap('').before(list);
// Transform each fieldset into a tab.
- $('> fieldset', this).each(function () {
- var tab = new Drupal.verticalTab({ title: $('> legend', this).text(), fieldset: $(this) });
+ $('> div.fieldset-wrapper', this).each(function () {
+ var tab = new Drupal.verticalTab({ title: $('fieldset:first > legend', this).text(), fieldsetWrapper: $(this) });
list.append(tab.item);
$(this)
- .removeClass('collapsible collapsed')
.addClass('vertical-tabs-pane')
.data('verticalTab', tab);
+ $('fieldset', this).removeClass('collapsible collapsed');
if (this.id == focusID) {
focus = $(this);
}
@@ -63,7 +63,7 @@ Drupal.verticalTab = function (settings)
return false;
});
- this.fieldset
+ this.fieldsetWrapper
.bind('summaryUpdated', function () {
self.updateSummary();
})
@@ -73,23 +73,23 @@ Drupal.verticalTab = function (settings)
Drupal.verticalTab.prototype = {
// Displays the tab's content pane.
focus: function () {
- this.fieldset
- .siblings('fieldset.vertical-tabs-pane')
+ this.fieldsetWrapper
+ .siblings('div.vertical-tabs-pane')
.each(function () {
var tab = $(this).data('verticalTab');
- tab.fieldset.hide();
+ tab.fieldsetWrapper.hide();
tab.item.removeClass('selected');
})
.end()
.show()
.siblings(':hidden.vertical-tabs-active-tab')
- .val(this.fieldset.attr('id'));
+ .val(this.fieldsetWrapper.attr('id'));
this.item.addClass('selected');
},
// Updates the tab's summary.
updateSummary: function () {
- this.summary.html(this.fieldset.getSummary());
+ this.summary.html(this.fieldsetWrapper.find('fieldset:first').getSummary());
}
};
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.886
diff -u -p -r1.886 system.module
--- modules/system/system.module 5 Feb 2010 21:20:00 -0000 1.886
+++ modules/system/system.module 5 Feb 2010 23:14:55 -0000
@@ -475,6 +475,7 @@ function system_element_info() {
'#theme_wrappers' => array('vertical_tabs'),
'#default_tab' => '',
'#process' => array('form_process_vertical_tabs'),
+ '#pre_render' => array('form_pre_render_vertical_tabs'),
);
$types['container'] = array(
Index: themes/garland/style.css
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/style.css,v
retrieving revision 1.73
diff -u -p -r1.73 style.css
--- themes/garland/style.css 30 Jan 2010 07:59:26 -0000 1.73
+++ themes/garland/style.css 5 Feb 2010 23:14:56 -0000
@@ -888,7 +888,7 @@ fieldset {
/* Keep the background position at 0 for filters and vertical tabs. */
*:first-child+html fieldset.filter-wrapper,
-*:first-child+html fieldset.vertical-tabs-pane {
+*:first-child+html div.vertical-tabs-pane {
background-position: 0 0;
}
@@ -932,7 +932,7 @@ div.vertical-tabs {
border-color: #d9eaf5;
}
-div.vertical-tabs .vertical-tabs-panes fieldset.vertical-tabs-pane {
+div.vertical-tabs .vertical-tabs-panes div.vertical-tabs-pane {
padding: 0.5em 1em;
}
Index: themes/seven/vertical-tabs.css
===================================================================
RCS file: /cvs/drupal/drupal/themes/seven/vertical-tabs.css,v
retrieving revision 1.4
diff -u -p -r1.4 vertical-tabs.css
--- themes/seven/vertical-tabs.css 11 Jan 2010 06:44:31 -0000 1.4
+++ themes/seven/vertical-tabs.css 5 Feb 2010 23:14:56 -0000
@@ -10,11 +10,17 @@ div.vertical-tabs {
background: #f8f8f8;
}
-div.vertical-tabs fieldset {
- border: 0;
+div.vertical-tabs div.vertical-tabs-pane {
padding: 0 0 0 20px;
}
+div.vertical-tabs div.vertical-tabs-pane fieldset {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ background: transparent;
+}
+
div.vertical-tabs .vertical-tabs-list {
line-height: 10px;
font-size: 11px;