Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1222
diff -u -p -r1.1222 common.inc
--- includes/common.inc	17 Sep 2010 14:53:21 -0000	1.1222
+++ includes/common.inc	19 Sep 2010 02:54:29 -0000
@@ -5498,6 +5498,47 @@ function element_info($type) {
 }
 
 /**
+ * Merges default element properties into a new element.
+ *
+ * @param $type
+ *   The element #type to load and use to merge default properties.
+ * @param $element
+ *   A new element array, into which the default element type properties are
+ *   intelligently merged.
+ */
+function element_merge($type, array $element) {
+  $defaults = element_info($type);
+
+  // Inform form_builder() and drupal_render() that defaults have been loaded.
+  $element['#defaults_loaded'] = TRUE;
+  if (empty($defaults)) {
+    return $element;
+  }
+
+  // Prepend custom values defined in $element to default element type info.
+  // Most often, the custom values are expected to take effect prior to the
+  // default values.
+  foreach (array('#process', '#pre_render', '#theme_wrappers') as $property) {
+    if (isset($defaults[$property])) {
+      $element += array($property => array());
+      $element[$property] = array_merge($element[$property], $defaults[$property]);
+    }
+  }
+  // Merge values in $element into default element type info. Custom scalar
+  // values override the default values, while array values are merged.
+  foreach (array('#attributes') as $property) {
+    if (isset($defaults[$property])) {
+      $element += array($property => array());
+      $element[$property] = array_merge($defaults[$property], $element[$property]);
+    }
+  }
+  // Add other default element properties, if undefined in $element.
+  $element += $defaults;
+
+  return $element;
+}
+
+/**
  * Function used by uasort to sort structured arrays by weight, without the property weight prefix.
  */
 function drupal_sort_weight($a, $b) {
Index: modules/field_ui/field_ui.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field_ui/field_ui.admin.inc,v
retrieving revision 1.66
diff -u -p -r1.66 field_ui.admin.inc
--- modules/field_ui/field_ui.admin.inc	16 Sep 2010 20:14:49 -0000	1.66
+++ modules/field_ui/field_ui.admin.inc	19 Sep 2010 02:55:25 -0000
@@ -1648,15 +1648,8 @@ function field_ui_field_edit_form($form,
   $bundles = field_info_bundles();
 
   // Create a form structure for the instance values.
-  // @todo Fieldset element info needs to be merged in order to not skip the
-  //   default element definition for #pre_render. While the current default
-  //   value could simply be hard-coded, we'd possibly forget this location
-  //   when system_element_info() is updated. See also form_builder(). This
-  //   particular #pre_render, field_ui_field_edit_instance_pre_render(), might
-  //   as well be entirely needless though.
-  $form['instance'] = array_merge(element_info('fieldset'), array(
+  $form['instance'] = element_merge('fieldset', array(
     '#tree' => TRUE,
-    '#type' => 'fieldset',
     '#title' => t('%type settings', array('%type' => $bundles[$entity_type][$bundle]['label'])),
     '#description' => t('These settings apply only to the %field field when used in the %type type.', array(
       '%field' => $instance['label'],
