Problem/Motivation
Drupal 6 text area text processing settings are not respected when migrating D6 fields to D8. Steps to reproduce:
D6 Field type: text
D6 Widget type: Text area (multiple rows)
D6 Global field settings / Text processing Plain text
Expected D8 field storage type: Text (plain, long)
Actual D8 field storage type: Text (formatted, long)
Proposed resolution
Fix getFieldType() of class \Drupal\text\Plugin\migrate\cckfield\TextField so that the text processing settings are respected.
Remaining tasks
I'll create a patch that fixes this and update the unit tests.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
masipila commentedComment #3
jeffwpetersen commentedIn order to migrate my fields correctly for my pourpses / test case I need to load widget_settings from the d6 content_node_field_instance table
and use the "size" or "row" settings to determine which field type would be used in D8.
If $widget_settings['size'] exists and is between then...
or if $widget_settings['rows'] exists and rows # than append _long...
Comment #4
masipila commentedHi,
if you have rows defined in D6, then isn't it so that the D6 widget type is always Text area (multiple rows), which indicates that this field should be migrated to D8 as either Text (plain, long) or Text (formatted, long) depending on the global text processing settings in D6? In other words, we don't need to investigate the global D6 field length if the widget type is Text area (multiple rows)?
Markus
Comment #5
jeffwpetersen commentedThe problem is that "max_length" is empty in 'global_settings' so I always get text_long. And the only way to determine if the field value is of type "size" is to load 'widget_settings' from content_node_field_instance.
So to get me to plain_text I need to test for the 'widget_settings' size value.
Comment #6
masipila commentedHi,
I just tested on my D6 test site that it is possible to updated the missing field length to the global field settings in D6. Could you test if you are able to do that? In other words
Cheers,
Markus
Comment #7
jeffwpetersen commentedMy error. I did not realize there was a global field.
After updating the global field with a value the migration worked as expected.
Comment #8
jeffwpetersen commentedComment #9
xjmWhy is this issue split off from #2842222: D7 Plain text fields incorrectly migrated to D8 as Text (formatted)? This seems like a discussion we should patch and fix all and one place because there are broad implications.
Comment #10
masipila commented@xjm: This is split from the parent issue so that the parent issue can focus on the D7 to D8 text field migration which is conceptually difficult due to the fact that D7 text formatting settings are defined on field instance settings. In D6 the text formatting settings are managed on global field settings, in other words on field storage settings.
This D6 textarea issue is straight forward and 1:1 with D8 and there should be nothing conceptually difficult here:
Hope this helps,
Markus
Comment #11
jeffwpetersen commentedThis has been tested and works as designed.
Comment #13
jofitzTestbot error, setting back to RTBC.
Comment #15
jofitzAt what point do we start worrying about these testbot failures? Setting back to RTBC.
Comment #17
joelpittetHere's a re-roll. Don't credit me, trying out a script I wrote to re-roll due to #2776975: March 3, 2017: Convert core to array syntax coding standards for Drupal 8.3.x RC phase
Comment #18
joelpittetComment #19
phenaproximaSelf-assigning for review.
Comment #20
heddnThere's tests. This fixes the problem. Seems strait forward enough (I don't see any need of additional code comments). RTBC.
Comment #22
mikeryanRandom testbot failure.
Comment #24
joelpittetComment #27
gábor hojtsyThanks all, especially the detailed response to @xjm. Comitted!