Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.921
diff -u -p -r1.921 common.inc
--- includes/common.inc	10 Jun 2009 20:00:10 -0000	1.921
+++ includes/common.inc	12 Jun 2009 05:12:18 -0000
@@ -3591,7 +3591,7 @@ function drupal_render_page($page) {
  * Recursively iterates over each of the array elements, generating HTML code.
  *
  * HTML generation is controlled by two properties containing theme functions,
- * #theme and #theme_wrapper.
+ * #theme and #theme_wrappers.
  *
  * #theme is the theme function called first. If it is set and the element has
  * any children, they have to be rendered there. For elements that are not
@@ -3600,21 +3600,22 @@ function drupal_render_page($page) {
  * children, they are rendered and concatenated into a string by
  * drupal_render_children().
  *
- * The theme function in #theme_wrapper will be called after #theme has run.
- * It can be used to add further markup around the rendered children, e.g.
- * fieldsets add the required markup for a fieldset around their rendered
- * child elements.  A wrapper theme function always has to include the
- * element's #children property in its output, as this contains the rendered
+ * The #theme_wrappers property contains an array of theme functions which will
+ * be called, in order, after #theme has run. These can be used to add further
+ * markup around the rendered children; e.g., fieldsets add the required markup
+ * for a fieldset around their rendered child elements. All wrapper theme
+ * functions have to include the element's #children property in their output,
+ * as it contains the output of the previous theme functions and the rendered
  * children.
  *
- * For example, for the form element type, by default only the #theme_wrapper
+ * For example, for the form element type, by default only the #theme_wrappers
  * property is set, which adds the form markup around the rendered child
  * elements of the form. This allows you to set the #theme property on a
  * specific form to a custom theme function, giving you complete control over
  * the placement of the form's children while not at all having to deal with
  * the form markup itself.
  *
- * This function is usually called from within a another function, like
+ * This function is usually called from within another function, like
  * drupal_get_form() or a theme function. Elements are sorted internally
  * using uasort(). Since this is expensive, when passing already sorted
  * elements to drupal_render(), for example from a database query, set
@@ -3699,10 +3700,12 @@ function drupal_render(&$elements) {
     $elements['#children'] = drupal_render_children($elements, $children);
   }
 
-  // Let the theme function in #theme_wrapper add markup around the rendered
+  // Let the theme functions in #theme_wrappers add markup around the rendered
   // children.
-  if (!empty($elements['#theme_wrapper'])) {
-    $elements['#children'] = theme($elements['#theme_wrapper'], $elements);
+  if (isset($elements['#theme_wrappers'])) {
+    foreach ($elements['#theme_wrappers'] as $theme_wrapper) {
+      $elements['#children'] = theme($theme_wrapper, $elements);
+    }
   }
 
   // Filter the outputted content and make any last changes before the
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.339
diff -u -p -r1.339 form.inc
--- includes/form.inc	2 Jun 2009 13:47:25 -0000	1.339
+++ includes/form.inc	12 Jun 2009 05:12:25 -0000
@@ -1917,7 +1917,7 @@ function form_process_text_format($eleme
     unset($element['value']['#description']);
     $element['#type'] = 'markup';
     $element['#theme'] = NULL;
-    $element['#theme_wrapper'] = 'text_format_wrapper';
+    $element['#theme_wrappers'] = array('text_format_wrapper');
     $element['format'] = filter_form($element['#text_format'], 1, $element_parents);
 
     // We need to clear the #text_format from the new child otherwise we
@@ -2086,14 +2086,14 @@ function theme_checkboxes($element) {
 }
 
 /**
- * Add form_element theming to an element if title or desription is set.
+ * Add form_element theming to an element if title or description is set.
  *
  * This is used as a pre render function for checkboxes and radios.
  */
 function form_pre_render_conditional_form_element($element) {
   if ($element['#title'] || $element['#description']) {
     unset($element['#id']);
-    $element['#theme_wrapper'] = 'form_element';
+    $element['#theme_wrappers'][] = 'form_element';
   }
   return $element;
 }
@@ -2331,7 +2331,7 @@ function form_process_vertical_tabs($ele
   // that manually.
   $element['group'] = array(
     '#type' => 'fieldset',
-    '#theme_wrapper' => '',
+    '#theme_wrappers' => array(),
     '#parents' => $element['#parents'],
   );
 
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.711
diff -u -p -r1.711 system.module
--- modules/system/system.module	11 Jun 2009 04:36:22 -0000	1.711
+++ modules/system/system.module	12 Jun 2009 05:12:32 -0000
@@ -250,7 +250,7 @@ function system_elements() {
   $type['form'] = array(
     '#method' => 'post',
     '#action' => request_uri(),
-    '#theme_wrapper' => 'form',
+    '#theme_wrappers' => array('form'),
   );
 
   $type['page'] = array(
@@ -275,7 +275,7 @@ function system_elements() {
     '#button_type' => 'submit',
     '#executes_submit_callback' => TRUE,
     '#process' => array('form_process_ahah'),
-    '#theme_wrapper' => 'button',
+    '#theme_wrappers' => array('button'),
   );
 
   $type['button'] = array(
@@ -284,7 +284,7 @@ function system_elements() {
     '#button_type' => 'submit',
     '#executes_submit_callback' => FALSE,
     '#process' => array('form_process_ahah'),
-    '#theme_wrapper' => 'button',
+    '#theme_wrappers' => array('button'),
   );
 
   $type['image_button'] = array(
@@ -295,7 +295,7 @@ function system_elements() {
     '#return_value' => TRUE,
     '#has_garbage_value' => TRUE,
     '#src' => NULL,
-    '#theme_wrapper' => 'image_button',
+    '#theme_wrappers' => array('image_button'),
   );
 
   $type['textfield'] = array(
@@ -305,7 +305,7 @@ function system_elements() {
     '#autocomplete_path' => FALSE,
     '#process' => array('form_process_text_format', 'form_process_ahah'),
     '#theme' => 'textfield',
-    '#theme_wrapper' => 'form_element',
+    '#theme_wrappers' => array('form_element'),
   );
 
   $type['password'] = array(
@@ -314,13 +314,13 @@ function system_elements() {
     '#maxlength' => 128,
     '#process' => array('form_process_ahah'),
     '#theme' => 'password',
-    '#theme_wrapper' => 'form_element',
+    '#theme_wrappers' => array('form_element'),
   );
 
   $type['password_confirm'] = array(
     '#input' => TRUE,
     '#process' => array('form_process_password_confirm'),
-    '#theme_wrapper' => 'form_element',
+    '#theme_wrappers' => array('form_element'),
   );
 
   $type['textarea'] = array(
@@ -330,13 +330,13 @@ function system_elements() {
     '#resizable' => TRUE,
     '#process' => array('form_process_text_format', 'form_process_ahah'),
     '#theme' => 'textarea',
-    '#theme_wrapper' => 'form_element',
+    '#theme_wrappers' => array('form_element'),
   );
 
   $type['radios'] = array(
     '#input' => TRUE,
     '#process' => array('form_process_radios'),
-    '#theme_wrapper' => 'radios',
+    '#theme_wrappers' => array('radios'),
     '#pre_render' => array('form_pre_render_conditional_form_element'),
   );
 
@@ -345,7 +345,7 @@ function system_elements() {
     '#default_value' => NULL,
     '#process' => array('form_process_ahah'),
     '#theme' => 'radio',
-    '#theme_wrapper' => 'form_element',
+    '#theme_wrappers' => array('form_element'),
     '#form_element_skip_title' => TRUE,
   );
 
@@ -353,7 +353,7 @@ function system_elements() {
     '#input' => TRUE,
     '#tree' => TRUE,
     '#process' => array('form_process_checkboxes'),
-    '#theme_wrapper' => 'checkboxes',
+    '#theme_wrappers' => array('checkboxes'),
     '#pre_render' => array('form_pre_render_conditional_form_element'),
   );
 
@@ -362,7 +362,7 @@ function system_elements() {
     '#return_value' => 1,
     '#process' => array('form_process_ahah'),
     '#theme' => 'checkbox',
-    '#theme_wrapper' => 'form_element',
+    '#theme_wrappers' => array('form_element'),
     '#form_element_skip_title' => TRUE,
   );
 
@@ -372,7 +372,7 @@ function system_elements() {
     '#multiple' => FALSE,
     '#process' => array('form_process_ahah'),
     '#theme' => 'select',
-    '#theme_wrapper' => 'form_element',
+    '#theme_wrappers' => array('form_element'),
   );
 
   $type['weight'] = array(
@@ -387,14 +387,14 @@ function system_elements() {
     '#element_validate' => array('date_validate'),
     '#process' => array('form_process_date'),
     '#theme' => 'date',
-    '#theme_wrapper' => 'form_element',
+    '#theme_wrappers' => array('form_element'),
   );
 
   $type['file'] = array(
     '#input' => TRUE,
     '#size' => 60,
     '#theme' => 'file',
-    '#theme_wrapper' => 'form_element',
+    '#theme_wrappers' => array('form_element'),
   );
 
   $type['tableselect'] = array(
@@ -413,7 +413,7 @@ function system_elements() {
   $type['item'] = array(
     '#markup' => '',
     '#theme' => 'markup',
-    '#theme_wrapper' => 'form_element',
+    '#theme_wrappers' => array('form_element'),
   );
 
   $type['hidden'] = array(
@@ -437,11 +437,11 @@ function system_elements() {
     '#value' => NULL,
     '#process' => array('form_process_fieldset', 'form_process_ahah'),
     '#pre_render' => array('form_pre_render_fieldset'),
-    '#theme_wrapper' => 'fieldset',
+    '#theme_wrappers' => array('fieldset'),
   );
 
   $type['vertical_tabs'] = array(
-    '#theme_wrapper' => 'vertical_tabs',
+    '#theme_wrappers' => array('vertical_tabs'),
     '#default_tab' => '',
     '#process' => array('form_process_vertical_tabs'),
   );
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1000
diff -u -p -r1.1000 user.module
--- modules/user/user.module	8 Jun 2009 05:00:11 -0000	1.1000
+++ modules/user/user.module	12 Jun 2009 05:12:38 -0000
@@ -892,7 +892,7 @@ function user_search($op = 'search', $ke
 function user_elements() {
   return array(
     'user_profile_category' => array(
-      '#theme_wrapper' => 'user_profile_category'
+      '#theme_wrappers' => array('user_profile_category')
     ),
     'user_profile_item' => array(
       '#theme' => 'user_profile_item'
