File-Field to Media-Field
Technical helper module to copy file / image field data to an existing Drupal Core Media field in the same entity / entities.
Only for developers (using drush), test carefully and take backups before use!
Condition:
You have one or multiple entity type bundles with a regular file / image field
(non-media, e.g. from a migration), and you want to migrate its instances
data into a media field.
The media field already exists and is empty or has to be created before using
this module. It should never have any values yet.
You do not want to use heavy weight migration.
How to use:
- Add a media field, of the desired type, to the entity bundle you want to copy the file-data to.
- Create a backup.
- Install the module.
- Run
drush filefield-to-media:copy file-field-name media-reference-field-name media-bundle media-type-media-field-name entity-type [entity-bundle] [--no-reuse]
- `entity-bundle` is optional
- `--no-reuse` => This disables the reuse of existing media entities when available. Use this when you experience issues with the reuse hashes, you are not using the default media field configuration or when you need to use duplicates with different alt or title text.
drush filefield-to-media:copy field_image field_image_media image field_media_image nodeAlternative / similar modules:
- https://www.drupal.org/project/migrate_file_to_media
- https://www.drupal.org/project/file_to_media
- https://www.drupal.org/project/media_migration
- https://www.drupal.org/project/migrate_media_handler
- https://www.drupal.org/project/image_media_migrate/
Development proudly sponsored by German Drupal Friends & Companies:
webks: websolutions kept simple (https://www.webks.de)
and
DROWL: Drupalbasierte Lösungen aus Ostwestfalen-Lippe (OWL), Germany (https://www.drowl.de)
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | Release date | |
|---|---|---|---|---|
| 1.0.0-beta1 | Pre-release | Feb 1, 2024 | ||
| 1.0.0-alpha2 | Pre-release | Jan 31, 2024 |