### 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 16:11:32 -0000
@@ -14,7 +14,7 @@
     case 'admin/help#options':
       $output = '';
       $output .= '<h3>' . t('About') . '</h3>';
-      $output .= '<p>' . t('The Options module defines checkbox, selection, and other input widgets for the Field module. See the <a href="@field-help">Field module help page</a> for more information about fields.', array('@field-help' => url('admin/help/field'))) . '</p>';
+      $output .= '<p>' . t('The Options module defines checkbox, selection, and other input widgets for the Field module. See the <a href="@field-help">Field module help page</a> for more information about fields.', array('@field-help' => url('admin/help/field'), )) . '</p>';
       return $output;
   }
 }
@@ -25,7 +25,7 @@
 function options_theme() {
   return array(
     'options_none' => array(
-      'variables' => array('instance' => NULL, 'option' => NULL),
+      'variables' => array('instance' => NULL, 'option' => NULL, ),
     ),
   );
 }
@@ -61,6 +61,7 @@
       'behaviors' => array(
         'multiple values' => FIELD_BEHAVIOR_CUSTOM,
       ),
+      'settings' => array('display_label' => 0, ),
     ),
   );
 }
@@ -100,7 +101,7 @@
       // If required and there is one single option, preselect it.
       if ($required && count($options) == 1) {
         reset($options);
-        $default_value = array(key($options));
+        $default_value = array(key($options), );
       }
       $element += array(
         '#type' => $multiple ? 'checkboxes' : 'radios',
@@ -122,12 +123,16 @@
       );
       // 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;
   }
 
   $element += array(
     '#value_key' => $value_key,
-    '#element_validate' => array('options_field_widget_validate'),
+    '#element_validate' => array('options_field_widget_validate', ),
     '#properties' => $properties,
   );
 
@@ -135,11 +140,36 @@
 }
 
 /**
+ * Implements hook_field_widget_settings_form().
+ */
+function options_field_widget_settings_form($field, $instance) {
+  $form = array();
+  $type = str_replace('options_', '', $instance['widget']['type']);
+  switch ($type) {
+    case 'select':
+      break;
+
+    case 'buttons':
+      break;
+
+    case '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,
+      );
+      break;
+  }
+  return $form;
+}
+
+/**
  * Form element validation handler for options element.
  */
 function options_field_widget_validate($element, &$form_state) {
   if ($element['#required'] && $element['#value'] == '_none') {
-    form_error($element, t('!name field is required.', array('!name' => $element['#title'])));
+    form_error($element, t('!name field is required.', array('!name' => $element['#title'], )));
   }
   // Transpose selections from field => delta to delta => field, turning
   // multiple selected options into multiple parent elements.
@@ -181,7 +211,7 @@
         if (!$required) {
           $properties['empty_option'] = 'option_none';
         }
-        else if (!$has_value) {
+        elseif (!$has_value) {
           $properties['empty_option'] = 'option_select';
         }
       }
@@ -225,8 +255,8 @@
   }
 
   if ($properties['empty_option']) {
-    $label = theme('options_none', array('instance' => $instance, 'option' => $properties['empty_option']));
-    $options = array('_none' => $label) + $options;
+    $label = theme('options_none', array('instance' => $instance, 'option' => $properties['empty_option'], ));
+    $options = array('_none' => $label, ) + $options;
   }
 
   return $options;
@@ -299,7 +329,7 @@
 
   // On/off checkbox: transform '0 / 1' into the 'on / off' values.
   if ($element['#type'] == 'checkbox') {
-    $values = array($values[0] ? $element['#on_value'] : $element['#off_value']);
+    $values = array(($values[0] ? $element['#on_value'] : $element['#off_value']), );
   }
 
   // Substitute the '_0' placeholder.
@@ -321,10 +351,10 @@
 
   // Make sure we populate at least an empty value.
   if (empty($values)) {
-    $values = array(NULL);
+    $values = array(NULL, );
   }
 
-  $result = options_array_transpose(array($element['#value_key'] => $values));
+  $result = options_array_transpose(array($element['#value_key'] => $values, ));
   return $result;
 }
 
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 16:11:33 -0000
@@ -1,12 +1,17 @@
 <?php
 // $Id: options.test,v 1.16 2010/08/17 21:48:39 dries Exp $
 
+/**
+ * @file
+ * Tests for the 'Options' field type widgets.
+ */
+
 class OptionsWidgetsTestCase extends FieldTestCase {
   public static function getInfo() {
     return array(
       'name'  => 'Options widgets',
       'description'  => "Test the Options widgets.",
-      'group' => 'Field types'
+      'group' => 'Field types',
     );
   }
 
@@ -50,7 +55,7 @@
     $this->bool = field_create_field($this->bool);
 
     // Create a web user.
-    $this->web_user = $this->drupalCreateUser(array('access field_test content', 'administer field_test content'));
+    $this->web_user = $this->drupalCreateUser(array('access field_test content', 'administer field_test content', ));
     $this->drupalLogin($this->web_user);
   }
 
@@ -77,25 +82,25 @@
     field_test_entity_save($entity);
 
     // With no field data, no buttons are checked.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertNoFieldChecked("edit-card-1-$langcode-0");
     $this->assertNoFieldChecked("edit-card-1-$langcode-1");
     $this->assertNoFieldChecked("edit-card-1-$langcode-2");
     $this->assertRaw('Some dangerous &amp; unescaped <strong>markup</strong>', t('Option text was properly filtered.'));
 
     // Select first option.
-    $edit = array("card_1[$langcode]" => 0);
+    $edit = array("card_1[$langcode]" => 0, );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0));
+    $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0, ));
 
     // Check that the selected button is checked.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertFieldChecked("edit-card-1-$langcode-0");
     $this->assertNoFieldChecked("edit-card-1-$langcode-1");
     $this->assertNoFieldChecked("edit-card-1-$langcode-2");
 
     // Unselect option.
-    $edit = array("card_1[$langcode]" => '_none');
+    $edit = array("card_1[$langcode]" => '_none', );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->assertFieldValues($entity_init, 'card_1', $langcode, array());
 
@@ -104,7 +109,7 @@
     field_update_field($this->card_1);
     $instance['required'] = TRUE;
     field_update_instance($instance);
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertFieldChecked("edit-card-1-$langcode-99");
   }
 
@@ -134,7 +139,7 @@
     field_test_entity_save($entity);
 
     // Display form: with no field data, nothing is checked.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertNoFieldChecked("edit-card-2-$langcode-0");
     $this->assertNoFieldChecked("edit-card-2-$langcode-1");
     $this->assertNoFieldChecked("edit-card-2-$langcode-2");
@@ -147,10 +152,10 @@
       "card_2[$langcode][2]" => TRUE,
     );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, 2));
+    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, 2, ));
 
     // Display form: check that the right options are selected.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertFieldChecked("edit-card-2-$langcode-0");
     $this->assertNoFieldChecked("edit-card-2-$langcode-1");
     $this->assertFieldChecked("edit-card-2-$langcode-2");
@@ -162,10 +167,10 @@
       "card_2[$langcode][2]" => FALSE,
     );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
+    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, ));
 
     // Display form: check that the right options are selected.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertFieldChecked("edit-card-2-$langcode-0");
     $this->assertNoFieldChecked("edit-card-2-$langcode-1");
     $this->assertNoFieldChecked("edit-card-2-$langcode-2");
@@ -194,7 +199,7 @@
     field_update_field($this->card_2);
     $instance['required'] = TRUE;
     field_update_instance($instance);
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertFieldChecked("edit-card-2-$langcode-99");
   }
 
@@ -222,7 +227,7 @@
     field_test_entity_save($entity);
 
     // Display form.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     // A required field without any value has a "none" option.
     $this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1-' . $langcode, ':label' => t('- Select a value -'))), t('A required select list has a "Select a value" choice.'));
 
@@ -234,19 +239,19 @@
     $this->assertRaw('Some dangerous &amp; unescaped markup', t('Option text was properly filtered.'));
 
     // Submit form: select invalid 'none' option.
-    $edit = array("card_1[$langcode]" => '_none');
+    $edit = array("card_1[$langcode]" => '_none', );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertRaw(t('!title field is required.', array('!title' => $instance['field_name'])), t('Cannot save a required field when selecting "none" from the select list.'));
+    $this->assertRaw(t('!title field is required.', array('!title' => $instance['field_name'], )), t('Cannot save a required field when selecting "none" from the select list.'));
 
     // Submit form: select first option.
-    $edit = array("card_1[$langcode]" => 0);
+    $edit = array("card_1[$langcode]" => 0, );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0));
+    $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0, ));
 
     // Display form: check that the right options are selected.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     // A required field with a value has no 'none' option.
-    $this->assertFalse($this->xpath('//select[@id=:id]//option[@value="_none"]', array(':id' => 'edit-card-1-' . $langcode)), t('A required select list with an actual value has no "none" choice.'));
+    $this->assertFalse($this->xpath('//select[@id=:id]//option[@value="_none"]', array(':id' => 'edit-card-1-' . $langcode, )), t('A required select list with an actual value has no "none" choice.'));
     $this->assertOptionSelected("edit-card-1-$langcode", 0);
     $this->assertNoOptionSelected("edit-card-1-$langcode", 1);
     $this->assertNoOptionSelected("edit-card-1-$langcode", 2);
@@ -256,12 +261,12 @@
     field_update_instance($instance);
 
     // Display form.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     // A non-required field has a 'none' option.
-    $this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1-' . $langcode, ':label' => t('- None -'))), t('A non-required select list has a "None" choice.'));
+    $this->assertTrue($this->xpath('//select[@id=:id]//option[@value="_none" and text()=:label]', array(':id' => 'edit-card-1-' . $langcode, ':label' => t('- None -'), )), t('A non-required select list has a "None" choice.'));
     // Submit form: Unselect the option.
-    $edit = array("card_1[$langcode]" => '_none');
-    $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save'));
+    $edit = array("card_1[$langcode]" => '_none', );
+    $this->drupalPost('test-entity/' . $entity->ftid . '/edit', $edit, t('Save'));
     $this->assertFieldValues($entity_init, 'card_1', $langcode, array());
 
     // Test optgroups.
@@ -271,7 +276,7 @@
     field_update_field($this->card_1);
 
     // Display form: with no field data, nothing is selected
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertNoOptionSelected("edit-card-1-$langcode", 0);
     $this->assertNoOptionSelected("edit-card-1-$langcode", 1);
     $this->assertNoOptionSelected("edit-card-1-$langcode", 2);
@@ -279,19 +284,19 @@
     $this->assertRaw('Group 1', t('Option groups are displayed.'));
 
     // Submit form: select first option.
-    $edit = array("card_1[$langcode]" => 0);
+    $edit = array("card_1[$langcode]" => 0, );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0));
+    $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0, ));
 
     // Display form: check that the right options are selected.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertOptionSelected("edit-card-1-$langcode", 0);
     $this->assertNoOptionSelected("edit-card-1-$langcode", 1);
     $this->assertNoOptionSelected("edit-card-1-$langcode", 2);
 
     // Submit form: Unselect the option.
-    $edit = array("card_1[$langcode]" => '_none');
-    $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save'));
+    $edit = array("card_1[$langcode]" => '_none', );
+    $this->drupalPost('test-entity/' . $entity->ftid . '/edit', $edit, t('Save'));
     $this->assertFieldValues($entity_init, 'card_1', $langcode, array());
   }
 
@@ -318,41 +323,41 @@
     field_test_entity_save($entity);
 
     // Display form: with no field data, nothing is selected.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertNoOptionSelected("edit-card-2-$langcode", 0);
     $this->assertNoOptionSelected("edit-card-2-$langcode", 1);
     $this->assertNoOptionSelected("edit-card-2-$langcode", 2);
     $this->assertRaw('Some dangerous &amp; unescaped markup', t('Option text was properly filtered.'));
 
     // Submit form: select first and third options.
-    $edit = array("card_2[$langcode][]" => array(0 => 0, 2 => 2));
+    $edit = array("card_2[$langcode][]" => array(0 => 0, 2 => 2, ));
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, 2));
+    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, 2, ));
 
     // Display form: check that the right options are selected.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertOptionSelected("edit-card-2-$langcode", 0);
     $this->assertNoOptionSelected("edit-card-2-$langcode", 1);
     $this->assertOptionSelected("edit-card-2-$langcode", 2);
 
     // Submit form: select only first option.
-    $edit = array("card_2[$langcode][]" => array(0 => 0));
+    $edit = array("card_2[$langcode][]" => array(0 => 0, ), );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
+    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, ));
 
     // Display form: check that the right options are selected.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertOptionSelected("edit-card-2-$langcode", 0);
     $this->assertNoOptionSelected("edit-card-2-$langcode", 1);
     $this->assertNoOptionSelected("edit-card-2-$langcode", 2);
 
     // Submit form: select the three options while the field accepts only 2.
-    $edit = array("card_2[$langcode][]" => array(0 => 0, 1 => 1, 2 => 2));
+    $edit = array("card_2[$langcode][]" => array(0 => 0, 1 => 1, 2 => 2, ), );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->assertText('this field cannot hold more than 2 values', t('Validation error was displayed.'));
 
     // Submit form: uncheck all options.
-    $edit = array("card_2[$langcode][]" => array());
+    $edit = array("card_2[$langcode][]" => array(), );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->assertFieldValues($entity_init, 'card_2', $langcode, array());
 
@@ -360,20 +365,20 @@
 
     // Check that the 'none' option has no efect if actual options are selected
     // as well.
-    $edit = array("card_2[$langcode][]" => array('_none' => '_none', 0 => 0));
-    $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save'));
-    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
+    $edit = array("card_2[$langcode][]" => array('_none' => '_none', 0 => 0, ));
+    $this->drupalPost('test-entity/' . $entity->ftid . '/edit', $edit, t('Save'));
+    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, ));
 
     // Check that selecting the 'none' option empties the field.
-    $edit = array("card_2[$langcode][]" => array('_none' => '_none'));
-    $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save'));
+    $edit = array("card_2[$langcode][]" => array('_none' => '_none', ));
+    $this->drupalPost('test-entity/' . $entity->ftid . '/edit', $edit, t('Save'));
     $this->assertFieldValues($entity_init, 'card_2', $langcode, array());
 
     // A required select list does not have an empty key.
     $instance['required'] = TRUE;
     field_update_instance($instance);
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
-    $this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-2-' . $langcode)), t('A required select list does not have an empty key.'));
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+    $this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-2-' . $langcode, )), t('A required select list does not have an empty key.'));
 
     // We do not have to test that a required select list with one option is
     // auto-selected because the browser does it for us.
@@ -388,7 +393,7 @@
     field_update_instance($instance);
 
     // Display form: with no field data, nothing is selected.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertNoOptionSelected("edit-card-2-$langcode", 0);
     $this->assertNoOptionSelected("edit-card-2-$langcode", 1);
     $this->assertNoOptionSelected("edit-card-2-$langcode", 2);
@@ -396,19 +401,19 @@
     $this->assertRaw('Group 1', t('Option groups are displayed.'));
 
     // Submit form: select first option.
-    $edit = array("card_2[$langcode][]" => array(0 => 0));
+    $edit = array("card_2[$langcode][]" => array(0 => 0, ), );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
+    $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, ));
 
     // Display form: check that the right options are selected.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertOptionSelected("edit-card-2-$langcode", 0);
     $this->assertNoOptionSelected("edit-card-2-$langcode", 1);
     $this->assertNoOptionSelected("edit-card-2-$langcode", 2);
 
     // Submit form: Unselect the option.
-    $edit = array("card_2[$langcode][]" => array('_none' => '_none'));
-    $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save'));
+    $edit = array("card_2[$langcode][]" => array('_none' => '_none', ));
+    $this->drupalPost('test-entity/' . $entity->ftid . '/edit', $edit, t('Save'));
     $this->assertFieldValues($entity_init, 'card_2', $langcode, array());
   }
 
@@ -435,27 +440,76 @@
     field_test_entity_save($entity);
 
     // Display form: with no field data, option is unchecked.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertNoFieldChecked("edit-bool-$langcode");
     $this->assertRaw('Some dangerous &amp; unescaped <strong>markup</strong>', t('Option text was properly filtered.'));
 
     // Submit form: check the option.
-    $edit = array("bool[$langcode]" => TRUE);
+    $edit = array("bool[$langcode]" => TRUE, );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertFieldValues($entity_init, 'bool', $langcode, array(0));
+    $this->assertFieldValues($entity_init, 'bool', $langcode, array(0, ));
 
     // Display form: check that the right options are selected.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
     $this->assertFieldChecked("edit-bool-$langcode");
 
     // Submit form: uncheck the option.
-    $edit = array("bool[$langcode]" => FALSE);
+    $edit = array("bool[$langcode]" => FALSE, );
     $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertFieldValues($entity_init, 'bool', $langcode, array(1));
+    $this->assertFieldValues($entity_init, 'bool', $langcode, array(1, ));
 
     // Display form: with 'off' value, option is unchecked.
-    $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+    $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->assertRaw('>MyOnValue </label>', t('Default case shows "On value"'));
+
+    //Enable setting
+    $edit = array('instance[widget][settings][display_label]' => 1, );
+    $this->drupalPost($fieldEditUrl, $edit, t('Save settings'));//Save the new 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->assertRaw(
+      '>' . $this->bool['field_name'] . ' </label>',
+      t('Display label changes label of the checkbox')
+    );
   }
 }
 
