Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Download Tracker 1.0.7 — Minor update available for module download_tracker (1.0.7). Release: Directory2Block Slideshow 1.0.8 — Minor update available for module directory2block_slideshow (1.0.8). Release: Mautic Audiences 1.1.5 — Minor update available for module mautic_audiences (1.1.5). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

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]
  1. `entity-bundle` is optional
  2. `--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.
  • Example: drush filefield-to-media:copy field_image field_image_media image field_media_image node
  • Alias is fftm and in the example above you can see the default command values, so running drush fftm would lead to the same outcome, as the example above.
  • Check if everything worked.
  • Delete the old file / image field if you don't need it anymore.
  • Alternative / similar modules:

    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

    Tracked releases
    2
    Tracked since
    Jan 2024
    Latest release
    2 years ago
    Releases (12 mo)
    0
    Maintenance
    Dormant

    Releases

    Version Type Core Release date
    1.0.0-beta1 Pre-release Feb 1, 2024
    1.0.0-alpha2 Pre-release Jan 31, 2024