Problem/Motivation
Follow-up to #2975666: Migrate Drupal 7 node entity translations data to Drupal 8.
When using the Entity Translation module in Drupal 7, most users were forced to enable the Title module to transform the title into a field which could then be translated. As such we should support the migration of this module's data.
Proposed resolution
Since the this module's replacement title field is a real field, the field config and field values are already migrated by the existing migrations. Even better, the translations are also migrated when using the patch from #2975666: Migrate Drupal 7 node entity translations data to Drupal 8.
What we still need to do is to skip the migration of this title field and map it's value to the node's title.
Other than nodes' title, this module also allow to replace the comments' subject and the terms' name and description by real fields.
Remaining tasks
- Write the patch
- Review
- Commit
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#28 | 2863437-28.patch | 108.15 KB | maxocub |
#28 | 2863437-28-without-fixtures.patch | 30.54 KB | maxocub |
#28 | interdiff-2863437-24-28.txt | 17.38 KB | maxocub |
Comments
Comment #2
mikeryanComment #5
heddnLet's at least bump to major from normal. Not sure if this should be 'Migrate Critical'.
Comment #6
masipila CreditAttribution: masipila commentedTagging with Migrate critical and Migrate Drupal according to the policy discussion for Migrate Drupal stability criteria.
This functionality was in contrib in D7 but the capability is provided by core in D8.
Comment #7
maxocub CreditAttribution: maxocub as a volunteer commentedSince the Title module exploits entity_translation to work, this issue should be postponed until we fix #2073467: Migrate Drupal 7 Entity Translation settings to Drupal 8. It may be resolved in that issue since the title module only transform the title into a normal field.
Comment #8
Feuerwagen#2073467: Migrate Drupal 7 Entity Translation settings to Drupal 8 is in.
Comment #9
FeuerwagenComment #10
maxocub CreditAttribution: maxocub as a volunteer commentedSorry but that fixed issue has been re-scoped to only deal with Entity Translation settings, so we're not quite ready to work on migrating Title data. We'll need to wait until the migration the actual translated data is supported: #2975666: Migrate Drupal 7 node entity translations data to Drupal 8.
Comment #11
maxocub CreditAttribution: maxocub as a volunteer commentedAdding the meta as the parent issue.
Comment #13
maxocub CreditAttribution: maxocub as a volunteer commentedThis does not have to be postponed on #2975666: Migrate Drupal 7 node entity translations data to Drupal 8. The Title module is not tied to the Entity Translation module.
I'm working on a patch.
Comment #14
maxocub CreditAttribution: maxocub as a volunteer commentedIS update.
Comment #15
maxocub CreditAttribution: maxocub as a volunteer commentedHere's a start. I will add tests soon.
Comment #16
maxocub CreditAttribution: maxocub as a volunteer commentedAfter pondering about this issue, I decided to put it back on postponed. Since the primary use of the Title module is with combination with the Entity Translation module, we should wait for the ET patch to land so we can add tests for the migration of title translations.
I included a patch combined with the latest patch from #2975666: Migrate Drupal 7 node entity translations data to Drupal 8, if people want to use it and test it.
Comment #17
masipila CreditAttribution: masipila commentedI read the patch (did not test it manually yet).
Does this mean that if a source site had a manually created field called 'description_field', it would be ignored?
The patch checks in several places simply for presence of title_field / description_field / name_field / subject_field. Is it so that we don't have any setting flag that could be used to explicitly check if Title module is used in that context?
If not, then I guess this is the best what we can do. It just feels like quite big assumption to always assume that for example description_field should be interpreted as an override of description. The good part that makes this somewhat less risky is the fact that the machine names of manually created fields typically have a 'field_' prefix.
Markus
Comment #18
maxocub CreditAttribution: maxocub as a volunteer commentedYou're right, we should definitely check if the Title module was enabled on the source. It is possible for someone to have created a field named 'title_field' programmatically, but if the Title module was enabled, then they would had have conflicts. I think we can safely assume that if there's a 'title_field' and that the Title module is enable, then the field is the one created but said module.
Here's a new approach.
Comment #19
masipila CreditAttribution: masipila commentedYay! I find this approach much more elegant.
I'll test this over the weekend.
Markus
Comment #20
Gábor Hojtsy#2975666: Migrate Drupal 7 node entity translations data to Drupal 8 is in.
Comment #21
maxocub CreditAttribution: maxocub as a volunteer commentedHere's a re-roll with a few improvements. It would be such a win to get this in 8.6 since most of the people who used Entity Translation also used Title.
Comment #23
maxocub CreditAttribution: maxocub as a volunteer commentedLet's turn those tests to green.
Comment #24
maxocub CreditAttribution: maxocub as a volunteer commentedOups, some code didn't checked if the Title module was enabled.
Comment #26
masipila CreditAttribution: masipila commentedQueued for PostgreSQL and SQLite tests. I'll find time to test this today.
Comment #27
masipila CreditAttribution: masipila as a volunteer commentedI reviewed the patch #24 and tested it manually.
Test setup in D7
1. Positive tests - Article configuration in D7
2. Negative tests - Article configuration in D7
3. Negative tests - Content type 'node_translation' configuration in D7
4. Negative tests - Content type 'monolingual' configuration in D7
Manual test content and test results
1 and 2: Positive and negative Article tests
All tests passed:
3. Negative tests - Content type 'node_translation'
All tests passed:
4. Negative tests - Content type 'monolingual'
All tests passed:
Conclusion from manual tests
Patch review comments
My earlier feedback in #17 was addressed already earlier. Ok.
When I started to do my manual tests, I was concerned about the behavior when the Title 'replace' has been set on one content type while some other content type has not the title 'replace' enabled. The test results were OK as stated above. This gotcha is handled as follows in the source plugin like this:
We are overriding the standard title only if a) the Title module exists AND b) title_field[0]['value'] is set. This is a very elegant way IMO to handle the scenario where some content types have the replacement enabled and others not. This is by far more elegant compared to a situation where we would do the if statement by checking the content type's 'replace' setting because this approach that @maxocub used is 100 times easier to maintain. @maxocub++.
Review of test coverage:
Kicking back for term name / description + comment title test coverage. If those were there already, please highlight those to me as a comment and I will re-review from my mobile.
Cheers,
Markus
Edit: Typos
Comment #28
maxocub CreditAttribution: maxocub as a volunteer commentedHere's some full migration tests and plugin tests for comment subject fields and taxonomy term name and description fields. Thanks for noticing those missing tests!
Comment #29
masipila CreditAttribution: masipila as a volunteer commentedHi!
Test coverage looks good to me now. According to the interdiff, all changes in this latest patch are test related so my manual test results are still valid.
I queued PostgreSQL and SQLite tests as well. Let's see what the testbot has to say about this latest patch.
Markus
Comment #30
masipila CreditAttribution: masipila as a volunteer commentedTests with the improved coverage are green. Manual tests are all green, see #27. I've reviewed the patch and feedback has been addressed. RTBC.
It would be superb if this could be committed to the same release as #2975666: Migrate Drupal 7 node entity translations data to Drupal 8.
Cheers,
Markus
Comment #33
Gábor HojtsyLooks good, thanks! I've been pondering a bit that we only added entity translation migrations for nodes so far, so having title migration support for others would be running ahead of ourselves, but there is no reason to not to do them here.