Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
If the Drupal 7 site uses the telephone field module the new migrated Drupal 8 site should also have a telephone field with the same content.
The Drupal 7 module https://www.drupal.org/project/telephone
Comment | File | Size | Author |
---|---|---|---|
#44 | 3005969-44.patch | 19.17 KB | quietone |
#44 | interdiff-42-44.txt | 2.62 KB | quietone |
#42 | 3005969-42.patch | 19.17 KB | longwave |
Comments
Comment #2
Ante890 CreditAttribution: Ante890 commentedDeleted comment
Comment #3
Ante890 CreditAttribution: Ante890 commentedComment #4
Ante890 CreditAttribution: Ante890 commentedI made a patch that worked for me
Comment #5
zaporylieComment #6
zaporylieComment #7
zaporylieAttempt to fix tests by including the telephone>telephone migration in migration tests.
Comment #9
gbirch CreditAttribution: gbirch commentedRe-roll of patch #7 against 8.7.x in hopes it will apply cleanly.
For anyone who gets here as puzzled as I, in the "extra" section of your composer file you must add:
To force the patch to be applied to the right place. Sorry for the confusion.
Comment #10
tstoecklerNice work! I have been working on this, as well. I guess at this point this needs to go into 9.1.x, so first of all I rerolled the patch.
Secondly, here's a review of the patch:
This is not necessary if the field type matches in D7 and D8.
This is leftover from the
Phone
migration and should be removed.I fixed those things and also added specific test coverage for the telephone module upgrade. Would love some reviews. If people here can review my test coverage then maybe we can collectively RTBC, because I RTBC the rest (barring the nitpicks above) as I came up with the nearly identical code when testing locally.
Comment #13
tstoecklerFor anyone following along at home: I was previously wondering why the previous patch didn't contain this hunk. I guess something changed in the test coverage in the meantime because this hunk is what makes the rerolled patch pass the tests.
Also fixes the remaining tests.
Comment #14
tstoecklerRe-rolled for 8.8
Comment #15
tstoecklerSo the previous patch was missing a formatter mapping. In D7 we have
text_plain
which maps tostring
in D8. Note that I found #3130240: Some field plugins declare an invalid default widget and formatter which is confusing (but should not impact this patch directly).In order to provide some test coverage I configured the
text_plain
formatter to be used in the teaser view mode. Unfortunately, that doesn't makeUpgrade7Test
fail, so uploading only that change separately to see if it fails any other test that I missed.Comment #19
tstoecklerSo the test-only patch in #15 nicely failed how it should, so this now includes the test-interdiff from above (in addition to the regular interdiff).
It also fixes the failure in
FieldDiscoveryTest
(see the new interdiff from this comment) so it should be green.Comment #21
tstoecklerNot exactly sure why I didn't see this failure earlier, in particular in #15, but this should fix the remaining failure. (Not attaching a separate interdiff for the 8.8.x patch, it's identical, but for the different number of entity view displays.)
Comment #22
gbirch CreditAttribution: gbirch commentedNeither the 8.8 nor 9.1 patches apply to 8.9. It is quite tedious to re-roll the whole patch, and does not seem worth doing given the move to Drupal 9. So for anyone who needs the functionality in the short term, this patch contains the functional portions of the master and applies against 8.9.x (8.9.3 as I write).
Comment #25
quietone CreditAttribution: quietone as a volunteer commentedThis is the first time I have seen this. There are tests in MigrateField and MigrateFieldInstance test for telephone fields so this may already be done. It requires some investigation.
This is a task because telephone is in core now and moving to the migration system where all things migrate live.
Comment #26
longwaveRerolled #21 for 9.2.x. Some of the migrate tests fail for me locally, but they also fail without this patch, not sure why - let's see what testbot thinks.
Comment #28
quietone CreditAttribution: quietone as a volunteer commentedI went ahead and fixed the test but I am still not sure we need this. Will come back to this after the migrate meeting.
Comment #29
longwave@quietone this is still needed, I am migrating a D7 site that uses Telephone fields (as opposed to Phone which is supported already), and without this patch the field instance fails to migrate.
Comment #30
quietone CreditAttribution: quietone as a volunteer commented@longwave, ah, thanks. I see now. So, both phone and telephone moved to core?
This needs a reroll.
Comment #31
tstoecklerRe #30: If I remember correctly, the history is as follows: First there was only Phone module for D7. Then that functionality got moved into D8 as the D8 telephone module and with some slightly different IDs for formatters, etc. And then someone backported the core telephone module and created the D7 Telephone module with the identical IDs as the D8 one. So "newer" D7 sites would have probably used D7 Telephone module (vs. Phone) in the hopes of better D8 compatibility (somewhat ironically, given this issue).
I think (though am not sure) that the backport, i.e. the creation of the D7 Telephone module happened after there was already a migration for the Phone module in place, but in any case it is missing. I assume it was just an oversight, because people thought that we do not need a migration because the IDs are the same.
Comment #32
longwaveRerolled.
Comment #33
quietone CreditAttribution: quietone as a volunteer commented@tstoeckler, thank you for the history. I've added this to my list to review. Should get to it early next week.
Also adding this to the D7 meta.
Comment #34
quietone CreditAttribution: quietone as a volunteer commentedDoes Wednesday count as early in the week?
Just a few more items and this will be ready.
Shouldn't 'string' be 'basic_string'. In Telephone, telephone_field_info also defines 'telephone_link' so another line is needed,
'telephone_link' => 'basic_string'
This also needs two additional assertions, one in \d7\MigrateFieldInstanceWidgetSettingsTest, and one in d7/MigrateFieldFormatterSettingsTest.php, both are an assertComponent at the end of the tests for the test_content_type,
Comment #35
ayushmishra206 CreditAttribution: ayushmishra206 at OpenSense Labs commentedWorking on this.
Comment #36
ayushmishra206 CreditAttribution: ayushmishra206 at OpenSense Labs commentedMade the changes suggested in #34. Please review. Thanks.
Comment #37
quietone CreditAttribution: quietone as a volunteer commented@ayushmishra206, thanks for working on this. Instead of letting drupalci run the checks on the code, you can do it locally. Running core development checks (>= 9.2.x) has all the instructions.
Comment #38
ayushmishra206 CreditAttribution: ayushmishra206 at OpenSense Labs commented@quietone Thanks for telling me this, I'll keep this in mind moving forward. I have made the changes causing the fail and tested it as well.
Comment #40
quietone CreditAttribution: quietone as a volunteer commented@ayushmishra206, thanks. Like the commit-code-check running the tests locally helps everyone. Some of the errors could have been fixed if you ran the tests locally. See https://www.drupal.org/docs/automated-testing/phpunit-in-drupal/running-.... And one of the error would have been picked up if you are using an IDE. I use PhpStorm and it complains loudly (visually) when the number of parameters doesn't match the method signature.
Now, for the reported errors I started with FieldDiscoveryTest. That need to be sorted before the others.
string needs to be basic_string and a line for the telephone link is needed.
This needs to be field_telephone. And it is missing the 'label' parameter, which is probably the default, 'above'. I don't know what the weight value should be.
$this->assertComponent('node.test_content_type.default', 'field_phone', 'basic_string', 'above', ??);
s/field_phone/field_telephone and s/telephone_link/telephone_default/
Comment #41
quietone CreditAttribution: quietone as a volunteer commentedThis is one of the last two issue in the Meta for D7 migrations and I'm keen to get them committed. Therefor, worked on a reroll.
Comment #42
longwave#41 is missing some of #38, fixed here and also addressed #40.
Comment #43
quietone CreditAttribution: quietone as a volunteer commented@longwave, thanks.
I am still not sure about the map in getFieldFormatterMap. I tested on D9 and a telephone can be 'string' or 'telehone_link'
So 'basic_string' here should be 'string', as it was originally. What confused me then was this in d7/MigrateFieldFormatterSettingsTest
and \Drupal\telephone\Plugin\migrate\field\d7\PhoneField maps to basic_string.
Based on the testing on D9, field_phone should also be a 'string'. Agree? If so, that will need a followup.
Since there really is a telephone_link type so this be 'telephone_link' => 'telephone_link',
I hope that makes sense. And the tests will need updating of course.
Comment #44
quietone CreditAttribution: quietone as a volunteer commentedI'm making that changes I suggested in #43.
Comment #45
longwave#43.1 yeah that is what confused me too, there is both a
basic_string
and astring
formatter butstring
is the right one here, I was misled by field_phone as well.#43.2 yep that makes sense too.
I agree with both changes therefore this is RTBC.
Comment #46
alexpottCommitted 9c5da7c and pushed to 9.2.x. Thanks!
Kicked off a test against 9.1.x - will backport if it passes.- the patch doesn't apply