Skip to content

Instantly share code, notes, and snippets.

@onesixromcom
onesixromcom / mymodule.install
Created Mar 12, 2021
Create media entities from existing file fields. Drupal 7 to 8 (9) migration.
View mymodule.install
<?php
use Drupal\media\Entity\Media;
use Drupal\file\Entity\File;
/**
* Create media entities from existing file fields.
*/
function mymodule_update_8801() {
$converts = [