### Eclipse Workspace Patch 1.0
#P drupal_test_7
Index: modules/field/field.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.test,v
retrieving revision 1.34
diff -u -r1.34 field.test
--- modules/field/field.test	15 Jul 2009 17:55:18 -0000	1.34
+++ modules/field/field.test	25 Jul 2009 23:01:55 -0000
@@ -1621,21 +1621,23 @@
     // Check that basic changes are saved.
     $instance = field_read_instance($this->instance_definition['field_name'], $this->instance_definition['bundle']);
     $instance['required'] = !$instance['required'];
-    $instance['weight']++;
     $instance['label'] = $this->randomName();
     $instance['description'] = $this->randomName();
     $instance['settings']['test_instance_setting'] = $this->randomName();
     $instance['widget']['settings']['test_widget_setting'] =$this->randomName();
+    $instance['widget']['weight']++;
     $instance['display']['full']['settings']['test_formatter_setting'] = $this->randomName();
+    $instance['display']['full']['weight']++;
     field_update_instance($instance);
 
     $instance_new = field_read_instance($this->instance_definition['field_name'], $this->instance_definition['bundle']);
     $this->assertEqual($instance['required'], $instance_new['required'], t('"required" change is saved'));
-    $this->assertEqual($instance['weight'], $instance_new['weight'], t('"weight" change is saved'));
     $this->assertEqual($instance['label'], $instance_new['label'], t('"label" change is saved'));
     $this->assertEqual($instance['description'], $instance_new['description'], t('"description" change is saved'));
     $this->assertEqual($instance['widget']['settings']['test_widget_setting'], $instance_new['widget']['settings']['test_widget_setting'], t('Widget setting change is saved'));
+    $this->assertEqual($instance['weight'], $instance_new['weight'], t('Widget weight change is saved'));
     $this->assertEqual($instance['display']['full']['settings']['test_formatter_setting'], $instance_new['display']['full']['settings']['test_formatter_setting'], t('Formatter setting change is saved'));
+    $this->assertEqual($instance['display']['full']['weight'], $instance_new['display']['full']['weight'], t('Widget weight change is saved'));
 
     // Check that changing widget and formatter types updates the default settings.
     $instance = field_read_instance($this->instance_definition['field_name'], $this->instance_definition['bundle']);
Index: modules/field/field.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.install,v
retrieving revision 1.9
diff -u -r1.9 field.install
--- modules/field/field.install	28 May 2009 10:05:32 -0000	1.9
+++ modules/field/field.install	25 Jul 2009 23:01:54 -0000
@@ -116,11 +116,6 @@
         'not null' => TRUE,
         'serialize' => TRUE,
       ),
-      'weight' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-        'default' => 0,
-      ),
       'deleted' => array(
         'type' => 'int',
         'size' => 'tiny',
Index: modules/field/field.default.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.default.inc,v
retrieving revision 1.10
diff -u -r1.10 field.default.inc
--- modules/field/field.default.inc	11 Jul 2009 00:56:45 -0000	1.10
+++ modules/field/field.default.inc	25 Jul 2009 23:01:54 -0000
@@ -135,7 +135,7 @@
 
     $element = $info + array(
       '#theme' => 'field',
-      '#weight' => $instance['weight'],
+      '#weight' => $display['weight'],
       '#title' => check_plain(t($instance['label'])),
       '#access' => field_access('view', $field),
       '#label_display' => $label_display,
Index: modules/field/field.crud.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.crud.inc,v
retrieving revision 1.21
diff -u -r1.21 field.crud.inc
--- modules/field/field.crud.inc	14 Jul 2009 10:27:29 -0000	1.21
+++ modules/field/field.crud.inc	25 Jul 2009 23:01:53 -0000
@@ -97,11 +97,6 @@
  *     A human-readable description for the field when used with this
  *     bundle. For example, the description will be the help text of
  *     Form API elements for this instance.
- * - weight (float)
- *     The order in which the field should be sorted relative
- *     to other fields when used with this bundle. The weight affects
- *     ordering in both forms (see field_attach_form()) and rendered output
- *     (see field_attach_view()).
  * - required (integer)
  *     TRUE if a value for this field is required when used with this
  *     bundle, FALSE otherwise. Currently, required-ness is only enforced
@@ -124,15 +119,18 @@
  *     - type (string)
  *         The type of the widget, such as text_textfield. Widget types
  *         are defined by modules that implement hook_field_widget_info().
+ *     - settings (array)
+ *         A sub-array of key/value pairs of widget-type-specific settings.
+ *         Each field widget type module defines and documents its own
+ *         widget settings.
+ *     - weight (float)
+ *         The weight of the widget relative to the other elements in object
+ *         edit forms.
  *     - module (string, read-only)
  *         The name of the module that implements the widget type.
  *     - active (integer, read-only)
  *         TRUE if the module that implements the widget type is currently
  *         enabled, FALSE otherwise.
- *     - settings (array)
- *         A sub-array of key/value pairs of widget-type-specific settings.
- *         Each field widget type module defines and documents its own
- *         widget settings.
  * - display (array)
  *     A sub-array of key/value pairs identifying build modes and the way the
  *     field values should be displayed in each build mode.
@@ -147,6 +145,9 @@
  *         - settings (array)
  *             A sub-array of key/value pairs of display options specific to
  *             the formatter.
+ *        - weight (float)
+ *            The weight of the field relative to the other object components
+ *            displayed in this build mode.
  *         - module (string, read-only)
  *             The name of the module which implements the display formatter.
  *     - teaser
@@ -524,6 +525,7 @@
     // TODO: what if no 'default_widget' specified ?
     'type' => $field_type['default_widget'],
     'settings' => array(),
+    'weight' => 0,
   );
   // Check widget module.
   $widget_type = field_info_widget_types($instance['widget']['type']);
@@ -544,6 +546,7 @@
       // TODO: what if no 'default_formatter' specified ?
       'type' => $field_type['default_formatter'],
       'settings' => array(),
+      'weight' => 0,
     );
     $formatter_type = field_info_formatter_types($instance['display'][$build_mode]['type']);
     // TODO : 'hidden' will raise PHP warnings.
@@ -555,7 +558,7 @@
   // not have its own column and is not automatically populated when the
   // instance is read.
   $data = $instance;
-  unset($data['id'], $data['field_id'], $data['field_name'], $data['bundle'], $data['widget']['type'], $data['weight'], $data['deleted']);
+  unset($data['id'], $data['field_id'], $data['field_name'], $data['bundle'], $data['widget']['type'], $data['deleted']);
 
   $record = array(
     'field_id' => $instance['field_id'],
@@ -564,7 +567,6 @@
     'widget_type' => $instance['widget']['type'],
     'widget_module' => $widget_module,
     'widget_active' => $widget_active,
-    'weight' => $instance['weight'],
     'data' => $data,
     'deleted' => $instance['deleted'],
   );
@@ -648,7 +650,6 @@
     $instance['field_id'] = $record['field_id'];
     $instance['field_name'] = $record['field_name'];
     $instance['bundle'] = $record['bundle'];
-    $instance['weight'] = $record['weight'];
     $instance['deleted'] = $record['deleted'];
     $instance['widget']['type'] = $record['widget_type'];
     $instance['widget']['module'] = $record['widget_module'];
Index: modules/field/field.form.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.form.inc,v
retrieving revision 1.11
diff -u -r1.11 field.form.inc
--- modules/field/field.form.inc	11 Jul 2009 00:56:45 -0000	1.11
+++ modules/field/field.form.inc	25 Jul 2009 23:01:54 -0000
@@ -92,7 +92,7 @@
     $defaults = array(
       '#field_name' => $field['field_name'],
       '#tree' => TRUE,
-      '#weight' => $instance['weight'],
+      '#weight' => $instance['widget']['weight'],
     );
 
     $addition[$field['field_name']] = array_merge($form_element, $defaults);
@@ -192,7 +192,6 @@
         '#type' => 'submit',
         '#name' => $field_name . '_add_more',
         '#value' => t('Add another item'),
-        '#weight' => $instance['weight'] + $max + 1,
         // Submit callback for disabled JavaScript.
         '#submit' => array('field_add_more_submit'),
         '#ahah' => array(
