Index: modules/comment/comment.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v
retrieving revision 1.66
diff -u -9 -p -r1.66 comment.install
--- modules/comment/comment.install	17 Apr 2010 12:54:02 -0000	1.66
+++ modules/comment/comment.install	28 Apr 2010 21:27:41 -0000
@@ -272,19 +272,19 @@ function comment_update_7012() {
     'entity_types' => array('comment'),
   );
   field_create_field($field);
 
   // Add the field to comments for all existing bundles.
   $body_instance = array(
     'field_name' => 'comment_body',
     'label' => 'Comment',
     'entity_type' => 'comment',
-    'settings' => array('text_processing' => 1),
+    'settings' => array('format' => ''),
     // Hide field label by default.
     'display' => array(
       'full' => array(
         'label' => 'hidden',
       ),
     ),
   );
   foreach (node_type_get_types() as $info) {
     $body_instance['bundle'] = 'comment_node_' . $info->type;
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.871
diff -u -9 -p -r1.871 comment.module
--- modules/comment/comment.module	26 Apr 2010 14:26:46 -0000	1.871
+++ modules/comment/comment.module	28 Apr 2010 21:27:41 -0000
@@ -354,19 +354,19 @@ function comment_node_type_delete($info)
  * type.
  */
 function _comment_body_field_instance_create($info) {
   // Attaches the body field by default.
   $instance = array(
     'field_name' => 'comment_body',
     'label' => 'Comment',
     'entity_type' => 'comment',
     'bundle' => 'comment_node_' . $info->type,
-    'settings' => array('text_processing' => 1),
+    'settings' => array('format' => ''),
     'required' => TRUE,
     // Hides field label by default.
     'display' => array(
       'full' => array(
         'label' => 'hidden',
       ),
     ),
   );
   field_create_instance($instance);
Index: modules/field/field.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.api.php,v
retrieving revision 1.75
diff -u -9 -p -r1.75 field.api.php
--- modules/field/field.api.php	24 Apr 2010 07:19:09 -0000	1.75
+++ modules/field/field.api.php	28 Apr 2010 21:27:41 -0000
@@ -149,35 +149,35 @@ function hook_field_extra_fields_alter(&
  *     type is available (i.e. provided by the field type module, or by a module
  *     the field type module depends on).
  */
 function hook_field_info() {
   return array(
     'text' => array(
       'label' => t('Text'),
       'description' => t('This field stores varchar text in the database.'),
       'settings' => array('max_length' => 255),
-      'instance_settings' => array('text_processing' => 0),
+      'instance_settings' => array('format' => filter_fallback_format()),
       'default_widget' => 'text_textfield',
       'default_formatter' => 'text_default',
     ),
     'text_long' => array(
       'label' => t('Long text'),
       'description' => t('This field stores long text in the database.'),
       'settings' => array('max_length' => ''),
-      'instance_settings' => array('text_processing' => 0),
+      'instance_settings' => array('format' => filter_fallback_format()),
       'default_widget' => 'text_textarea',
       'default_formatter' => 'text_default',
     ),
     'text_with_summary' => array(
       'label' => t('Long text and summary'),
       'description' => t('This field stores long text in the database along with optional summary text.'),
       'settings' => array('max_length' => ''),
-      'instance_settings' => array('text_processing' => 1, 'display_summary' => 0),
+      'instance_settings' => array('format' => '', 'display_summary' => 0),
       'default_widget' => 'text_textarea_with_summary',
       'default_formatter' => 'text_summary_or_trimmed',
     ),
   );
 }
 
 /**
  * Perform alterations on Field API field types.
  *
@@ -291,19 +291,19 @@ function hook_field_schema($field) {
  *   parameter by reference.
  */
 function hook_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {
   // Sample code from text.module: precompute sanitized strings so they are
   // stored in the field cache.
   foreach ($entities as $id => $entity) {
     foreach ($items[$id] as $delta => $item) {
       // Only process items with a cacheable format, the rest will be handled
       // by formatters if needed.
-      if (empty($instances[$id]['settings']['text_processing']) || filter_format_allowcache($item['format'])) {
+      if (filter_format_allowcache($item['format'])) {
         $items[$id][$delta]['safe_value'] = isset($item['value']) ? _text_sanitize($instances[$id], $langcode, $item, 'value') : '';
         if ($field['type'] == 'text_with_summary') {
           $items[$id][$delta]['safe_summary'] = isset($item['summary']) ? _text_sanitize($instances[$id], $langcode, $item, 'summary') : '';
         }
       }
     }
   }
 }
 
Index: modules/field/modules/text/text.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/text/text.module,v
retrieving revision 1.53
diff -u -9 -p -r1.53 text.module
--- modules/field/modules/text/text.module	13 Apr 2010 15:16:27 -0000	1.53
+++ modules/field/modules/text/text.module	28 Apr 2010 21:27:41 -0000
@@ -19,46 +19,47 @@ function text_help($path, $arg) {
   }
 }
 
 /**
  * Implements hook_field_info().
  *
  * Field settings:
  *   - max_length: the maximum length for a varchar field.
  * Instance settings:
- *   - text_processing: whether text input filters should be used.
+ *   - format: an text format enforced on the field. When empty, the user may
+ *     select the text format.
  *   - display_summary: whether the summary field should be displayed.
  *     When empty and not displayed the summary will take its value from the
  *     trimmed value of the main text field.
  */
 function text_field_info() {
   return array(
     'text' => array(
       'label' => t('Text'),
       'description' => t('This field stores varchar text in the database.'),
       'settings' => array('max_length' => 255),
-      'instance_settings' => array('text_processing' => 0),
+      'instance_settings' => array('format' => filter_fallback_format()),
       'default_widget' => 'text_textfield',
       'default_formatter' => 'text_default',
     ),
     'text_long' => array(
       'label' => t('Long text'),
       'description' => t('This field stores long text in the database.'),
       'settings' => array('max_length' => ''),
-      'instance_settings' => array('text_processing' => 0),
+      'instance_settings' => array('format' => filter_fallback_format()),
       'default_widget' => 'text_textarea',
       'default_formatter' => 'text_default',
     ),
     'text_with_summary' => array(
       'label' => t('Long text and summary'),
       'description' => t('This field stores long text in the database along with optional summary text.'),
       'settings' => array('max_length' => ''),
-      'instance_settings' => array('text_processing' => 1, 'display_summary' => 0),
+      'instance_settings' => array('format' => '', 'display_summary' => 0),
       'default_widget' => 'text_textarea_with_summary',
       'default_formatter' => 'text_summary_or_trimmed',
     ),
   );
 }
 
 /**
  * Implements hook_field_schema().
  */
@@ -131,28 +132,32 @@ function text_field_settings_form($field
   );
 
   return $form;
 }
 
 /**
  * Implements hook_field_instance_settings_form().
  */
 function text_field_instance_settings_form($field, $instance) {
+  global $user;
   $settings = $instance['settings'];
 
-  $form['text_processing'] = array(
-    '#type' => 'radios',
-    '#title' => t('Text processing'),
-    '#default_value' => $settings['text_processing'],
-    '#options' => array(
-      t('Plain text'),
-      t('Filtered text (user selects text format)'),
-    ),
+  $formats = filter_formats($user);
+  $options = array('' => t('User selects text format'));
+  foreach ($formats as $format) {
+    $options[$format->format] = $format->name;
+  }
+  $form['format'] = array(
+    '#type' => 'select',
+    '#title' => t('Text format'),
+    '#options' => $options,
+    '#default_value' => $settings['format'],
+    '#attributes' => array('class' => array('filter-list')),
   );
   if ($field['type'] == 'text_with_summary') {
     $form['display_summary'] = array(
       '#type' => 'checkbox',
       '#title' => t('Summary input'),
       '#default_value' => $settings['display_summary'],
       '#description' => t('This allows authors to input an explicit summary, to be displayed instead of the automatically trimmed text when using the "Summary or trimmed" display type.'),
     );
   }
@@ -201,19 +206,19 @@ function text_field_validate($entity_typ
  * separately.
  *
  * @see text_field_formatter_view()
  */
 function text_field_load($entity_type, $entities, $field, $instances, $langcode, &$items) {
   foreach ($entities as $id => $entity) {
     foreach ($items[$id] as $delta => $item) {
       // Only process items with a cacheable format, the rest will be handled
       // by formatters if needed.
-      if (empty($instances[$id]['settings']['text_processing']) || filter_format_allowcache($item['format'])) {
+      if (filter_format_allowcache($item['format'])) {
         $items[$id][$delta]['safe_value'] = isset($item['value']) ? _text_sanitize($instances[$id], $langcode, $item, 'value') : '';
         if ($field['type'] == 'text_with_summary') {
           $items[$id][$delta]['safe_summary'] = isset($item['summary']) ? _text_sanitize($instances[$id], $langcode, $item, 'summary') : '';
         }
       }
     }
   }
 }
 
@@ -268,33 +273,33 @@ function text_field_formatter_info() {
 function text_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
   $element = array();
 
   switch ($display['type']) {
     case 'text_default':
     case 'text_trimmed':
       foreach ($items as $delta => $item) {
         $output = _text_sanitize($instance, $langcode, $item, 'value');
         if ($display['type'] == 'text_trimmed') {
-          $output = text_summary($output, $instance['settings']['text_processing'] ? $item['format'] : NULL);
+          $output = text_summary($output, $item['format']);
         }
         $element[$delta] = array('#markup' => $output);
       }
       break;
 
     case 'text_summary_or_trimmed':
       foreach ($items as $delta => $item) {
         if (!empty($item['summary'])) {
           $output = _text_sanitize($instance, $langcode, $item, 'summary');
         }
         else {
           $output = _text_sanitize($instance, $langcode, $item, 'value');
           $size = variable_get('teaser_length_' . $instance['bundle'], 600);
-          $output = text_summary($output, $instance['settings']['text_processing'] ? $item['format'] : NULL, $size);
+          $output = text_summary($output, $item['format'], $size);
         }
         $element[$delta] = array('#markup' => $output);
       }
       break;
 
     case 'text_plain':
       foreach ($items as $delta => $item) {
         $element[$delta] = array('#markup' => strip_tags($item['value']));
       }
@@ -322,19 +327,19 @@ function text_field_formatter_view($enti
  * @return
  *  The sanitized string.
  */
 function _text_sanitize($instance, $langcode, $item, $column) {
   // If the value uses a cacheable text format, text_field_load() precomputes
   // the sanitized string.
   if (isset($item["safe_$column"])) {
     return $item["safe_$column"];
   }
-  return $instance['settings']['text_processing'] ? check_markup($item[$column], $item['format'], $langcode) : check_plain($item[$column]);
+  return check_markup($item[$column], $item['format'], $langcode);
 }
 
 /**
  * Generate a trimmed, formatted version of a text field value.
  *
  * If the end of the summary is not indicated using the <!--break--> delimiter
  * then we generate the summary automatically, trying to end it at a sensible
  * place such as the end of a paragraph, a line break, or the end of a
  * sentence (in that order of preference).
@@ -550,27 +555,31 @@ function text_field_widget_form(&$form, 
         '#default_value' => isset($items[$delta]['value']) ? $items[$delta]['value'] : NULL,
         '#rows' => $instance['widget']['settings']['rows'],
         '#attributes' => array('class' => array('text-full')),
       );
       break;
   }
 
   if ($main_widget) {
     // Conditionally alter the form element's type if text processing is enabled.
-    if ($instance['settings']['text_processing']) {
+    if ($instance['settings']['format']) {
+      $element['value'] = $main_widget;
+      $element['format'] = array(
+        '#type' => 'value',
+        '#value' => $instance['settings']['format'],
+      );
+    }
+    else {
       $element = $main_widget;
       $element['#type'] = 'text_format';
       $element['#format'] = isset($items[$delta]['format']) ? $items[$delta]['format'] : NULL;
       $element['#base_type'] = $main_widget['#type'];
     }
-    else {
-      $element['value'] = $main_widget;
-    }
   }
   if ($summary_widget) {
     $element['summary'] = $summary_widget;
   }
 
   return $element;
 }
 
 /**
Index: modules/field/modules/text/text.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/text/text.test,v
retrieving revision 1.22
diff -u -9 -p -r1.22 text.test
--- modules/field/modules/text/text.test	10 Apr 2010 10:01:15 -0000	1.22
+++ modules/field/modules/text/text.test	28 Apr 2010 21:27:41 -0000
@@ -84,19 +84,19 @@ class TextFieldTestCase extends DrupalWe
     $this->field_name = drupal_strtolower($this->randomName());
     $this->field = array('field_name' => $this->field_name, 'type' => $field_type);
     field_create_field($this->field);
     $this->instance = array(
       'field_name' => $this->field_name,
       'entity_type' => 'test_entity',
       'bundle' => 'test_bundle',
       'label' => $this->randomName() . '_label',
       'settings' => array(
-        'text_processing' => TRUE,
+        'format' => '',
       ),
       'widget' => array(
         'type' => $widget_type,
       )
     );
     field_create_instance($this->instance);
     $langcode = LANGUAGE_NONE;
 
     // Display creation form.
@@ -138,19 +138,19 @@ class TextFieldTestCase extends DrupalWe
     $this->field_name = drupal_strtolower($this->randomName());
     $this->field = array('field_name' => $this->field_name, 'type' => $field_type);
     field_create_field($this->field);
     $this->instance = array(
       'field_name' => $this->field_name,
       'entity_type' => 'test_entity',
       'bundle' => 'test_bundle',
       'label' => $this->randomName() . '_label',
       'settings' => array(
-        'text_processing' => TRUE,
+        'format' => '',
       ),
       'widget' => array(
         'type' => $widget_type,
       )
     );
     field_create_instance($this->instance);
     $langcode = LANGUAGE_NONE;
 
     // Delete all text formats besides the plain text fallback format.
Index: modules/field_ui/field_ui.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/field_ui/field_ui.api.php,v
retrieving revision 1.5
diff -u -9 -p -r1.5 field_ui.api.php
--- modules/field_ui/field_ui.api.php	26 Apr 2010 14:40:47 -0000	1.5
+++ modules/field_ui/field_ui.api.php	28 Apr 2010 21:27:43 -0000
@@ -52,39 +52,39 @@ function hook_field_settings_form($field
  *
  * @param $field
  *   The field structure being configured.
  * @param $instance
  *   The instance structure being configured.
  * @return
  *   The form definition for the field instance settings.
  */
 function hook_field_instance_settings_form($field, $instance) {
+  global $user;
   $settings = $instance['settings'];
 
-  $form['text_processing'] = array(
-    '#type' => 'radios',
-    '#title' => t('Text processing'),
-    '#default_value' => $settings['text_processing'],
-    '#options' => array(
-      t('Plain text'),
-      t('Filtered text (user selects text format)'),
-    ),
+  $formats = filter_formats($user);
+  $options = array('' => t('User selects text format'));
+  foreach ($formats as $format) {
+    $options[$format->format] = $format->name;
+  }
+  $form['format'] = array(
+    '#type' => 'select',
+    '#title' => t('Text format'),
+    '#options' => $options,
+    '#default_value' => $settings['format'],
+    '#attributes' => array('class' => array('filter-list')),
   );
   if ($field['type'] == 'text_with_summary') {
     $form['display_summary'] = array(
-      '#type' => 'select',
-      '#title' => t('Display summary'),
-      '#options' => array(
-        t('No'),
-        t('Yes'),
-      ),
-      '#description' => t('Display the summary to allow the user to input a summary value. Hide the summary to automatically fill it with a trimmed portion from the main post. '),
-      '#default_value' => !empty($settings['display_summary']) ? $settings['display_summary'] :  0,
+      '#type' => 'checkbox',
+      '#title' => t('Summary input'),
+      '#default_value' => $settings['display_summary'],
+      '#description' => t('This allows authors to input an explicit summary, to be displayed instead of the automatically trimmed text when using the "Summary or trimmed" display type.'),
     );
   }
 
   return $form;
 }
 
 /**
  * Widget settings form.
  *
