### Eclipse Workspace Patch 1.0
#P drupal_HEAD
Index: modules/field/modules/options/options.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/options/options.module,v
retrieving revision 1.27
diff -u -r1.27 options.module
--- modules/field/modules/options/options.module	17 Aug 2010 21:48:39 -0000	1.27
+++ modules/field/modules/options/options.module	2 Sep 2010 19:42:22 -0000
@@ -61,6 +61,7 @@
       'behaviors' => array(
         'multiple values' => FIELD_BEHAVIOR_CUSTOM,
       ),
+      'settings' => array('display_label' => 0),
     ),
   );
 }
@@ -122,6 +123,10 @@
       );
       // Override the title from the incoming $element.
       $element['#title'] = isset($options[$on_value]) ? $options[$on_value] : '';
+
+      if ($instance['widget']['settings']['display_label']) {
+        $element['#title'] = $instance['label'];
+      }
       break;
   }
 
@@ -135,6 +140,22 @@
 }
 
 /**
+ * Implements hook_field_widget_settings_form().
+ */
+function options_field_widget_settings_form($field, $instance) {
+  $form = array();
+  if ($instance['widget']['type'] == 'options_onoff') {
+    $form['display_label'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Use field label instead the "On value" as label'),
+      '#default_value' => $instance['widget']['settings']['display_label'],
+      '#weight' => -1,
+    );
+  }
+  return $form;
+}
+
+/**
  * Form element validation handler for options element.
  */
 function options_field_widget_validate($element, &$form_state) {
Index: modules/field/modules/options/options.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/options/options.test,v
retrieving revision 1.16
diff -u -r1.16 options.test
--- modules/field/modules/options/options.test	17 Aug 2010 21:48:39 -0000	1.16
+++ modules/field/modules/options/options.test	2 Sep 2010 19:42:22 -0000
@@ -456,6 +456,62 @@
     // Display form: with 'off' value, option is unchecked.
     $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
     $this->assertNoFieldChecked("edit-bool-$langcode");
+
+    // Create admin user.
+    $admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer taxonomy'));
+    $this->drupalLogin($admin_user);
+
+    // Create a test field instance.
+    $fieldUpdate = $this->bool;
+    $fieldUpdate['settings']['allowed_values'] = "0|0\n1|MyOnValue";
+    field_update_field($fieldUpdate);
+    $instance = array(
+      'field_name' => $this->bool['field_name'],
+      'entity_type' => 'node',
+      'bundle' => 'page',
+      'widget' => array(
+            'type' => 'options_onoff',
+            'module' => 'options',
+        ),
+    );
+    field_create_instance($instance);
+
+    // Go to the edit page and check if the default settings works as expected
+    $fieldEditUrl = 'admin/structure/types/manage/page/fields/bool';
+    $this->drupalGet($fieldEditUrl);
+
+    $this->assertText(
+      'Use field label instead the "On value" as label ',
+      t('Display setting checkbox available.')
+    );
+
+    $this->assertFieldByXPath(
+      '*//label[@for="edit-' . $this->bool['field_name'] . '-und" and text()="MyOnValue "]',
+      TRUE,
+      t('Default case shows "On value"')
+    );
+
+    // Enable setting
+    $edit = array('instance[widget][settings][display_label]' => 1);
+    // Save the new Settings
+    $this->drupalPost($fieldEditUrl, $edit, t('Save settings'));
+
+    // Go again to the edit page and check if the setting
+    // is stored and has the expected effect
+    $this->drupalGet($fieldEditUrl);
+    $this->assertText(
+      'Use field label instead the "On value" as label ',
+      t('Display setting checkbox is available')
+    );
+    $this->assertFieldChecked(
+      'edit-instance-widget-settings-display-label',
+      t('Display settings checkbox checked')
+    );
+    $this->assertFieldByXPath(
+      '*//label[@for="edit-' . $this->bool['field_name'] . '-und" and text()="' . $this->bool['field_name'] . ' "]',
+      TRUE,
+      t('Display label changes label of the checkbox')
+    );
   }
 }
 
