Quellcode durchsuchen

Fixed problem with text fields not properly dealing with HTML content

Stephen Ficklin vor 8 Jahren
Ursprung
Commit
9987ce03af

+ 8 - 0
tripal_chado/includes/tripal_chado.field_storage.inc

@@ -293,6 +293,14 @@ function tripal_chado_field_storage_load($entity_type, $entities, $age,
           if ($schema['fields'][$field_column]['type'] == 'text') {
             $record = chado_expand_var($record, 'field', "$field_table.$field_column");
             $entity->{$field_name}['und'][0]['value'] = $record->$field_column;
+            // Text fields that have a text_processing == 1 setting need a
+            // special 'format' element too:
+            if (array(key_exists('text_processing', $instance['settings']) and
+                $instance['settings']['text_processing'] == 1)) {
+              // TODO: we need a way to write the format back to the
+              // instance settings if the user changes it when using the form.
+              $entity->{$field_name}['und'][0]['format'] = array_key_exists('format', $instance['settings']) ? $instance['settings']['format'] : 'full_html';
+            }
           }
         }
       }

+ 2 - 1
tripal_chado/includes/tripal_chado.fields.inc

@@ -634,7 +634,8 @@ function tripal_chado_bundle_create_instances_base(&$info, $entity_type, $bundle
         break;
       case 'text':
         $base_info['widget']['type'] = 'text_textarea';
-        $base_info['widget']['settings']['format'] = filter_default_format();
+        $base_info['settings']['text_processing'] = '1';
+        $base_info['settings']['format'] = 'full_html';
         break;
       case 'blob':
         // not sure how to support a blob field.