anyone know of a quick example of how to change the field settings for a text area (plain) to formatted and set the input formatter (or maybe it will use default)? Will this require a resave of all the data or can it just be changed for the entity type? I currently have a lot of existing data on this site.

The field is currently stored as the type string, Text (plain). I need to change it to text_long, Text (formatted, long).



3 Answers 3


Attention for Drupal 8:

You need to update at least 3 or 4 yml files


(same change)


--- a/config/default/field.storage.node.field_description.yml
+++ b/config/default/field.storage.node.field_description.yml
@@ -4,13 +4,13 @@
     - node
+    - text
 id: node.field_description
 field_name: field_description
 entity_type: node
-type: string_long
-  case_sensitive: false
-module: core
+type: text_long
+settings: {  }
+module: text
 locked: false
 cardinality: 1
 translatable: true


-type: string_textarea 
+type: text_textarea


-type: basic_string
+type: text_default

Maybe the last 2 ones you can deal with those changes on UI(go to each teaser and save). But I did in config folder.

  • While this will have changed the appearance of the node form, the data will not be saved correctly, and will not be displayed correctly.
    – Dalin
    Commented Oct 24, 2019 at 14:54
  • While this didn't work per se, it did work with the help of this blog article because the formatter and widget settings were hidden with that approach and this allowed me to adjust those in the YAML files, thanks @carlos blog.42mate.com/…
    – joelpittet
    Commented Oct 7, 2020 at 17:14

Oh wow, I just tried something in hopes of it being easy and it was a breeze!...

I already have all my config exported to code so I compared a text_long field to my current string_long field and just merged the differences, it worked beautifully. Something like the changes in the following example patch:

--- config/prod/field.field.node.page.field_description.yml (revision 3ef14eada9090087d33a10ec532732e515fef151)
+++ config/prod/field.field.node.page.field_description.yml (revision )
@@ -5,6 +5,8 @@
     - field.storage.node.field_description
     - node.type.page
+  module:
+    - text
 id: node.researcher.field_description
 field_name: field_description
 entity_type: node
@@ -16,4 +18,4 @@
 default_value: {  }
 default_value_callback: ''
 settings: {  }
-field_type: string_long
+field_type: text_long

imported the changed config et voila! Just beautiful.

  • 4
    I doubt it really just works like that. Note that the field type is also in the storage, and that changing the field type results in a different field schema, which drupal will actually prevent you from changing if you try it on the field storage config.
    – Berdir
    Commented Oct 23, 2016 at 11:12
  • @Berdir of course you are correct. Guess I am still looking to solve this. Seemed good at first but then I noted the display was rendering with html markup. Commented Oct 24, 2016 at 23:13

You can use the module Druidfire by CHX.


Drush 10 command: drush druidfire:string2formatted entity_type field_name

It's not hosted on drupal.org and is unlikely to be. Use with caution.

Example update hook for your module_name.install file:

 * Change field my_field to formatted text.
function module_namee_update_8001() {   
  \Drupal::service('druidfire')->kaboom('string2formatted', 'node', 'field_my_field');
  • This seems useful, why isn't it on Drupal.org?
    – Kevin
    Commented Oct 21, 2021 at 3:01
  • @Kevin See: drupal.org/project/drupal/issues/3079843#comment-13250398 "But note the standard "there is no warranty" clause, even more so than usual because this module bypasses the entity APIs. Even if I moved this module to drupal.org it very likely would become a sandbox because there is absolutely no way I would want to support it. "
    – imclean
    Commented Oct 27, 2021 at 4:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.