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.

CommentFileSizeAuthor
#34 Screenshot from 2020-03-24 10-47-43.png159.57 KBplato1123
#34 Screenshot from 2020-03-24 10-46-35.png19.53 KBplato1123
#34 Screenshot from 2020-03-24 10-45-32.png15.86 KBplato1123
#20 interdiff.txt538 bytesSam152
#20 2623950-11-emvideo-migrate-support-20.patch162.39 KBSam152
#19 2623950-11-emvideo-migrate-support-15.patch162.45 KBSam152
#15 2623950-11-emvideo-migrate-support-15.patch3.36 KBSam152
#12 interdiff.txt3.76 KBSam152
#11 interdiff.txt1.28 MBSam152
#11 2623950-11-emvideo-migrate-support.patch1.28 MBSam152
#9 2623950-9-emvideo-migrate-support.patch1.27 KBphilipz
#3 2623950-3-emvideo-migrate-support.patch1.27 KBphilipz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

philipz created an issue. See original summary.

Sam152’s picture

This 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

philipz’s picture

Title: Migrate from Drupal 6 » Video embed field migration from Drupal 6
Assigned: philipz » Unassigned
Status: Active » Needs review
Related issues: +#2610062: Document implementing migration paths for contrib modules
FileSize
1.27 KB

With help from @benjy this turned out to be quite easy.

Sam152’s picture

Firstly, thanks for working on this. I have a few points of feedback:

  1. +++ modules/video_embed_field/src/Plugin/migrate/cckfield/EmvideoField.php	(date 1449611625000)
    @@ -0,0 +1,53 @@
    + * Contains \Drupal\video_embed_field\Plugin\migrate\cckfield\EmvideoField.
    

    How is this class named? EmvideoField sounds a little arbitrary?

  2. +++ modules/video_embed_field/src/Plugin/migrate/cckfield/EmvideoField.php	(date 1449611625000)
    @@ -0,0 +1,53 @@
    +      'thumbnail' => 'thumbnail'
    

    Missing a tailing comma.

  3. +++ modules/video_embed_field/src/Plugin/migrate/cckfield/EmvideoField.php	(date 1449611625000)
    @@ -0,0 +1,53 @@
    +      'process' => array(
    +        'value' => 'embed'
    +      )
    

    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.

philipz’s picture

I'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?

Sam152’s picture

If 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.

Sam152’s picture

Title: Video embed field migration from Drupal 6 » Write migration from Drupal 6 for Embedded Media Field
Sam152’s picture

I 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?

philipz’s picture

Sam152’s picture

This is looking great. See how you go with the tests and we can get this merged.

Sam152’s picture

Resurrection! 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.

Sam152’s picture

FileSize
3.76 KB

Interdiff sans dump file.

benjy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

Sam152’s picture

Status: Reviewed & tested by the community » Needs work

I think this can be simplified further now that #2748467: Allow children of migration test bases to substitute their own fixtures. is in.

Sam152’s picture

Status: Needs review » Needs work

The last submitted patch, 15: 2623950-11-emvideo-migrate-support-15.patch, failed testing.

The last submitted patch, 15: 2623950-11-emvideo-migrate-support-15.patch, failed testing.

The last submitted patch, 15: 2623950-11-emvideo-migrate-support-15.patch, failed testing.

Sam152’s picture

Sam152’s picture

  • Sam152 committed 3e1c1cd on 8.x-1.x authored by philipz
    Issue #2623950 by Sam152, philipz: Write migration from Drupal 6 for...
Sam152’s picture

Status: Needs review » Fixed

Better late than never, thanks for the contribution philipz.

The last submitted patch, 11: 2623950-11-emvideo-migrate-support.patch, failed testing.

The last submitted patch, 15: 2623950-11-emvideo-migrate-support-15.patch, failed testing.

The last submitted patch, 19: 2623950-11-emvideo-migrate-support-15.patch, failed testing.

Status: Fixed » Needs work

The last submitted patch, 20: 2623950-11-emvideo-migrate-support-20.patch, failed testing.

Sam152’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

aiphes’s picture

Suscribe to this, how to migrate content from emfield to this module with migrate ?
Actually, emfield fields are missing after running migrations.

Ambient.Impact’s picture

I 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.

plato1123’s picture

@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?

Ambient.Impact’s picture

@plato1123 I've updated the links. Looks like I'd merged and deleted that branch but forgot I'd linked to it. 😅

plato1123’s picture

@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!

plato1123’s picture

@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.

Ambient.Impact’s picture

@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:

      media_entity:
        plugin: entity_load
        entity_type: media
        source: '@media_id'

And third, you should already have the media entity ID in '@media_id', so you can replace value: '@media_entity' with target_id: '@media_id'.

Let me know how that goes.