From 314b9185929822a1cce28b01805eb34f3916f459 Mon Sep 17 00:00:00 2001
From: Angie Byron <webchick@24967.no-reply.drupal.org>
Date: Wed, 3 Jun 2009 02:38:47 +0000
Subject: [PATCH] #369011 follow-up by yched: Some touch-ups to comments, etc.

---
 modules/field/modules/text/text.module | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/field/modules/text/text.module b/modules/field/modules/text/text.module
index 198b69e7def3..7c31d54cb0a3 100644
--- a/modules/field/modules/text/text.module
+++ b/modules/field/modules/text/text.module
@@ -123,13 +123,12 @@ function text_field_load($obj_type, $objects, $field, $instances, &$items) {
 
   foreach ($objects as $id => $object) {
     foreach ($items[$id] as $delta => $item) {
-      // TODO D7 : this code is really node-related.
       if (!empty($instances[$id]['settings']['text_processing'])) {
-        $check = is_null($object) || (isset($object->build_mode) && $object->build_mode == NODE_BUILD_PREVIEW);
-
         // Only process items with a cacheable format, the rest will be
         // handled by text_field_sanitize().
         if (filter_format_allowcache($item['format'])) {
+          // TODO D7 : this code is really node-related.
+          $check = is_null($object) || (isset($object->build_mode) && $object->build_mode == NODE_BUILD_PREVIEW);
           $text = isset($item['value']) ? check_markup($item['value'], $item['format'], isset($object->language) ? $object->language : $language->language, $check, FALSE) : '';
         }
       }
@@ -152,10 +151,11 @@ function text_field_sanitize($obj_type, $object, $field, $instance, &$items) {
   global $language;
   foreach ($items as $delta => $item) {
     // Only sanitize items which were not already processed inside
-    // text_field_load(), i.e. items with uncacheable text formats.
+    // text_field_load(), i.e. items with uncacheable text formats, or coming
+    // from a form preview.
     if (!isset($items[$delta]['safe'])) {
-      // TODO D7 : this code is really node-related.
       if (!empty($instance['settings']['text_processing'])) {
+        // TODO D7 : this code is really node-related.
         $check = is_null($object) || (isset($object->build_mode) && $object->build_mode == NODE_BUILD_PREVIEW);
         $text = isset($item['value']) ? check_markup($item['value'], $item['format'], isset($object->language) ? $object->language : $language->language, $check) : '';
       }
-- 
GitLab