- πΊπΈUnited States mlncn Minneapolis, MN, USA
This looks promising: https://www.drupal.org/project/drupal/issues/2835825#comment-15237330 π Add d8 media migration Postponed
And separate from that, we have successfully done it with an approach that doesn't use the migrate module, MigrationHelperFieldTransformations in the Migration Helpers β module, used like this:
function example_deploy_move_files_to_media() { $transformations = [ [ 'node', // entity type ['field_attachments'], // old file/IMCE fields 'field_media_attachments', // new media reference field ['page', 'forms_resources'], // bundles on the entity type that holds both the old file and new media reference fields 'document', // the destination media bundle 'field_media_document', // the destination file field on the media bundle ], ]; \Drupal::logger('nchfa_custom')->log(LogLevel::INFO, "Transformation started."); foreach ($transformations as $transformation) { [$entity_type, $image_field_names, $media_field_name, $bundles, $media_entity_bundle, $media_target_field] = $transformation; /** @var \Drupal\migration_helpers\MigrationHelperFieldTransformations $field_transformations_service */ $field_transformations_service = \Drupal::service('migration_helpers.field_transformations'); $field_transformations_service->fieldToMediaEntity($entity_type, $image_field_names, $media_field_name, $bundles, $media_entity_bundle, $media_target_field); $source_fields = implode(', ', $image_field_names); \Drupal::logger('nchfa_custom')->log(LogLevel::INFO, "Data in image field(s) $source_fields of $entity_type entity moved to $media_field_name media reference field."); } }
Don't worry about the references to image in the code it works for all files!
- π¨πSwitzerland lomale@bluewin.ch Switzerland
I come back on this, the other way round.
I was using IMCE for our content types since D8 and it's worked very well, but now we'd like to make those images available in the D10 media library.
There is also a problem, that the IMCE icon does not show anymore in the image field on D10Can someone help how you would solve this problem.
Is there a preferred way to migrate those from IMCE to the D10 media library?Would I have to do this manually. not imaginable
Thanks for your answers
Lothar