Problem/Motivation
Drupal 8 has separate field storage types Text (plain) and Text (formatted). There's also Text (plain, long) and Text (formatted, long). The important part here is that this selection is done on field storage level.
In Drupal 7, the text processing settings are defined on Field instance settings. In other words, the text processing settings can be plain text on one content type and filtered html on another.
In Drupal 6, the text processing settings are defined on global field settings which is equivalent of Drupal 8 field storage settings.
There are two issues on how text fields are migrated to Drupal 8.
- Drupal 7 text fields and long text fields are currently migrated to Drupal 8 as Text (formatted) / Text (formatted, long). This is problematic from two different aspects: a) single-line text fields are migrated as Text (formatted) which is rarely the desired behavior and b) migrating content of D7 plain text field to a Drupal 8 Text (formatted) field might have security implications if the content filtering settings are not correctly set.
- When analyzing the Drupal 7 issue mentioned above, it was identified that the Drupal 6 text formatting settings were not respected even though they can be mapped 1:1 to Drupal 8. This topic is handled as a separate child issue: #2849861: D6 text area formatting settings not respected when migrating to D8
Proposed resolution
For the Drupal 7 text fields, the proposed resolution is as follows:
* Common base for d7_field, d7_field_instance sources
* if the text or text_long field has only plain text instances, migrate to string or string_long field.
* If the text or text_long field has only filtered text instances, migrate to text or text_long field.
* if the text or text_long field has both plain text and filtered text instances, don't migrate and log a message indicating the required steps in order to fix this (fix the instances on the source site or use custom migration)
* If there are instances of both text-y and string-y types, string-y instances fall back to text with plain_text filter
* 'entity_exists' process plugin (to check for plain_text filter)
* 'log' process plugin (to log errors if the filter doesn't exist)
The proposed resolution for the Drupal 6 issue is covered in the child issue: #2849861: D6 text area formatting settings not respected when migrating to D8
Remaining tasks
- Agree if the proposed resolution is the way to go.
- Figure out how the D7 field instances can be fetched from the context of the field storage migration.
- Modify the field storage migration logic so that it takes the D7 instance filtering settings into account.
- Tests, lots of them.
User interface changes
None.
API changes
None, hopefully.
Data model changes
None, hopefully.
---clips---
When this issue was analyzed, all possible permutations of the Drupal 6 and Drupal 7 text fields were analyzed. The findings of this analysis is listed below for reference purposes.
Summary of the analysis: D7 - D8 migrations
Scenario ID: D7/1
D7 Field type: Text
D7 Widget type: Text field
D7 Global field settings: 255 or less
Current D8 field storage type: Text (formatted)
This scenario is currently being discussed in the comments of this issue. D7 text processing settings are on field instance settings, not in global field storage settings. It is not possible to determine the text processing from field instance settings so we need to choose if we want to migrate to Text (plain) or Text (formatted).
Single-line text fields are typically not used for formatted text (but of course it is possible that this would be the case). It is being proposed that we would change the migration of this scenario so that the target D8 field type would be Text (plain) instead of Text (formatted).
Scenario ID: D7/2
D7 Field type: Text
D7 Widget type: Text field
D7 Global field settings: 256 or more
Current D8 field storage type: Text (formatted)
This scenario has a bug: if the field length exceeds 255 characters, we have data loss because the current D8 target field type Text (formatted) is limited to 255 characters. Child issue has been created to change the target field type to Text (formatted, long). See #2849864: D7 text fields with long field length incorrectly migrated to D8.
This scenario is currently being discussed in the comments of this issue. The same comments as in the scenario D7/1 apply with the exception that the discussion is whether the D8 target field type should be Text (plain, long) or Text (formatted, long). Update: now that the field length is working as expected, this scenario is effectively same as D7/1. In other words, the question is between Text (plain) vs. Text (formatted).
Scenario ID: D7/3
D7 Field type: Long text
D7 Widget type: Text area (multiple rows)
D7 Global field settings: n/a
Current D8 field storage type: Text (formatted, long)
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.
Scenario ID: D7/4
D7 Field type: Long text and summary
D7 Widget type: Text area with summary
D7 Global field settings: n/a
Current D8 field storage type: Text (formatted, long, with summary)
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.
Summary of the analysis: D6 - D8 migrations
Scenario ID: D6/1
D6 Field type: text
D6 Widget type: Text field
D6 Global field settings: a) Text processing Plain text b) max length less than 256
Current D8 field storage type: Text (plain)
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.
Scenario ID: D6/2
D6 Field type: text
D6 Widget type: Text field
D6 Global field settings: a) Text processing Plain b) max length greater than 255.
Current D8 field storage type: Text (plain, long)
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.
Scenario ID: D6/3
D6 Field type: text
D6 Widget type: Text field
D6 Global field settings: a) Text processing Plain b) max length not defined
Current D8 field storage type: Text (plain, long)
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.
Scenario ID: D6/4
D6 Field type: text
D6 Widget type: Text field
D6 Global field settings: a) Text processing Filtered text b) max length less than 256
Current D8 field storage type: Text (formatted)
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.
Scenario ID: D6/5
D6 Field type: text
D6 Widget type: Text field
D6 Global field settings: a) Text processing Filtered text b) max length greater than 255
Current D8 field storage type: Text (formatted, long)
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.
Scenario ID: D6/6
D6 Field type: text
D6 Widget type: Text field
D6 Global field settings: a) Text processing Filtered text b) max length not defined
Current D8 field storage type: Text (formatted, long)
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.
Scenario ID: D6/7
D6 Field type: text
D6 Widget type: Text area (multiple rows)
D6 Global field settings: a) Text processing Plain b) max length: does not matter
Current D8 field storage type: Text (formatted, long)
The analysis revealed a bug in this scenario. D6 has text processing on global settings. If the text processing has been set to Plain Text in D6, that should be maintained in the migration. A child issue has been created to handle this issue. See #2849861: D6 text area formatting settings not respected when migrating to D8
Scenario ID: D6/8
D6 Field type: text
D6 Widget type: Text area (multiple rows)
D6 Global field settings: a) Text processing Filtered text b) max length: does not matter
Current D8 field storage type: Text (formatted, long)
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.
Scenario ID: D6/9
D6 Field type: text
D6 Widget type: Select list
D6 Global field settings: Does not matter
Current D8 field storage type: List (text)
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.
Scenario ID: D6/10
D6 Field type: text
D6 Widget type: Check boxes / radio buttons
D6 Global field settings: Does not matter
Current D8 field storage type: List (text)
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.
Scenario ID: D6/11
D6 Field type: text
D6 Widget type: Single on/off checkbox
D6 Global field settings: Does not matter
Proposal for D8 migration: Boolean
No issues found in the analysis. No changes proposed. This scenario is here for reference purposes only.