From a365b198b66bb16619ab2901538f9d044a16cdac Mon Sep 17 00:00:00 2001
From: Angie Byron <webchick@24967.no-reply.drupal.org>
Date: Sat, 13 Nov 2010 07:39:35 +0000
Subject: [PATCH] #617596 follow-up by sun: optimize if statement.

---
 modules/field/modules/text/text.module | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/modules/field/modules/text/text.module b/modules/field/modules/text/text.module
index c4739a4d1e57..08f06229ca3b 100644
--- a/modules/field/modules/text/text.module
+++ b/modules/field/modules/text/text.module
@@ -170,13 +170,8 @@ function text_field_load($entity_type, $entities, $field, $instances, $langcode,
  * Implements hook_field_is_empty().
  */
 function text_field_is_empty($item, $field) {
-  if (empty($item['value']) && (string) $item['value'] !== '0') {
-    if ($field['type'] == 'text_with_summary') {
-      return (empty($item['summary']) && (string)$item['summary'] !== '0');
-    }
-    else {
-      return TRUE;
-    }
+  if (!isset($item['value']) || $item['value'] === '') {
+    return !isset($item['summary']) || $item['summary'] === '';
   }
   return FALSE;
 }
-- 
GitLab