We have Drupal Paragraphs using image fields that are media entities. When the media entity is updated with a new image the old images still show unless we manually edit each page, remove the image from the paragraph, and add it back. We have tested using entity reference fields that reference those same media entities and they update. How can we programatically convert the image field to an entity reference field or copy over the references from that field to the media entity field?
In a mile high explanation:
- add entity reference field to content type.
- you can use rules, or a php-script to load all the nodes for your content type.
- loop through each node, get the field value
fidof the image paragraph field, assign it to the entity reference field.
- save the node
After all the above is done, remove/delete the paragraph bundle.