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.
I know this module does not have Drupal 6 version but I'm wondering if there could be a drupal upgrade path from different module that seems to be doing almost exactly the same thing in Drupal 6 but does not have Drupal 8 release.
The module I'm talking about is Embedded Media Field.
I know drupal upgrate migration documentation is not yet finished but I'm going to try and implement this for my project.
Comment | File | Size | Author |
---|---|---|---|
#34 | Screenshot from 2020-03-24 10-47-43.png | 159.57 KB | plato1123 |
#34 | Screenshot from 2020-03-24 10-46-35.png | 19.53 KB | plato1123 |
#34 | Screenshot from 2020-03-24 10-45-32.png | 15.86 KB | plato1123 |
#20 | interdiff.txt | 538 bytes | Sam152 |
#20 | 2623950-11-emvideo-migrate-support-20.patch | 162.39 KB | Sam152 |
Comments
Comment #2
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedThis should be possible. For an example of what this might look like you can have a look at: https://www.drupal.org/sandbox/benjy/2422307
Comment #3
philipz CreditAttribution: philipz as a volunteer commentedWith help from @benjy this turned out to be quite easy.
Comment #4
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedFirstly, thanks for working on this. I have a few points of feedback:
How is this class named? EmvideoField sounds a little arbitrary?
Missing a tailing comma.
Mixed array syntax and trailing commas.
I'd like to see tests for the migrations as well as a migration for the Drupal 6 and and 7 versions of the actual video_embed_field modules, but these can be looked at in follow up tickets if benjy is happy with the status of this migration.
Comment #5
philipz CreditAttribution: philipz as a volunteer commentedI'll fix the patch and upload today but one quick question first.
The name of the class I used is taken both from the field type (machine code) in Drupal 6 as well as the source module name.
The actual module which enables this field is called Embedded Media Field (https://www.drupal.org/project/emfield).
So before I change anything please let me know how else could the class be named?
Comment #6
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedIf the class name matches the machine name of the field type in Drupal 6, then I don't believe you need to make any changes there.
Comment #7
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #8
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedI have also opened up some issues for the migrations for this video_embed_field modules for D6 and 7, but it would probably be best for tests to be committed with each migration.
Do you want to look into writing those?
Comment #9
philipz CreditAttribution: philipz as a volunteer commentedGreat then here's updated patch. I'll try to write the tests - @benjy already sent me some tips on how to do this.
Comment #10
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedThis is looking great. See how you go with the tests and we can get this merged.
Comment #11
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedResurrection! I've had a go at writing the tests for these migrations (it look some patience). Thanks for your work on this philipz and I apologise it took so long to get around to finishing this off.
Here is the test + interdiff if you are still interested in a review.
Comment #12
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedInterdiff sans dump file.
Comment #13
benjy CreditAttribution: benjy at PreviousNext commentedLooks good.
Comment #14
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedI think this can be simplified further now that #2748467: Allow children of migration test bases to substitute their own fixtures. is in.
Comment #15
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedWay simpler test.
Comment #19
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedWith the fixture.
Comment #20
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedFew things fixed up.
Comment #22
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedBetter late than never, thanks for the contribution philipz.
Comment #27
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedComment #29
aiphesSuscribe to this, how to migrate content from emfield to this module with migrate ?
Actually, emfield fields are missing after running migrations.
Comment #30
Ambient.ImpactI know this issue is for the Drupal 6 Emfield module, but has anyone managed to get a Drupal 7 Emfield to Drupal 8 Video Embed Field migration working?
Edit: found Migrating Drupal 7 File Entities to Drupal 8 Media Entities and used that to come up with a working migration:
Note that these don't currently have user mapping as they're for my own site (where I'm the only user), but that may be added later.
I've documented the process in a readme. Hopefully this helps someone who's run into the same issue.
Comment #31
plato1123 CreditAttribution: plato1123 commented@Ambient.Impact I really wanted to look over your migration but all of your links are now broken. Is there somewhere else I can see your findings/tricks/tweaks?
Comment #32
Ambient.Impact@plato1123 I've updated the links. Looks like I'd merged and deleted that branch but forgot I'd linked to it. 😅
Comment #33
plato1123 CreditAttribution: plato1123 commented@Ambient.Impact Spectacular work, I was able to successfully migrate remote videos, something I had been working on and tinkering with for weeks. The previousnext blog post you linked to and drew inspiration from (that I had also tried to follow_ has a lot of issues with the latest version of Drupal, your changes helped me get over the finish line. Thanks again!
Comment #34
plato1123 CreditAttribution: plato1123 commented@Ambient.Impact One more question for you since you've been on fire with this!! I was able to duplicate your work and have remote youtube videos migrated to the Drupal 8 media library. I've even been able to do your rather complex migrate lookup migration to grab the youtube video link and put it in a text field in our drupal 8 video node type. What I haven't quite been able to do is, instead of populating a text field with the video link, is to populate an entity reference field on our video nodes that points to the media library.
So on our video nodes I have a couple fields I've been playing with, one is just a text field with a youtube link, the other is a video field that is a reference to videos in the media library.
Reading other discussions it seems like to populate an entity reference you just use something like field_gbz_video_ref/target: and then I'd have to modify your value script to grab something like the media ID (so value: '@media_entity/mid/0/value' ), but i've tried dozens of different combinations and cannot populate the entity reference field with anything under any circumstances.
Any idea how to populate entity reference fields? Even if I knew what static content it would accept I could troubleshoot from that point, but I've tried populating with the media IDs, various arrays with that info, the file IDs, so many different things. Any ideas? I've attached a few screenshots showing my field setup and my version of your migration (that was truly a master stroke, thank you so much for that!) Cheers and thank you for your hard work.
edit: My screenshot shows field_gbz_video_ref/target: but I was actually testing with field_gbz_video_ref/0/target_id: and field_gbz_video_ref/target_id: which also doesn't seem to work.
Comment #35
Ambient.Impact@plato1123 Sorry for the late reply. It's been quite a while since I've touched the migrations, but from what I recall, the linking of the media entities to their parent entity (i.e. node or paragraph item) was done by the Migrate File Entities to Media Entities module for image media entities, so I would assume the process would be the same for video media entities. I'm not sure why I didn't document it for video media. If you want to use your existing migration, you can alter it as follows:
Firstly, I think it should just be
field_gbz_video_ref
at the top.Secondly, you should be able to just remove this block as it isn't needed:
And third, you should already have the media entity ID in
'@media_id'
, so you can replacevalue: '@media_entity'
withtarget_id: '@media_id'
.Let me know how that goes.