I'm coming back to a site that was built (a) before media_wysiwyg_view_mode was added to the Media module stack, and (b) also before the site builder (gulp, that was me) fully understood how to utilise custom view modes for file entity types. Going forward, I now have a small set of custom view modes set up for image file entities, and I've restricted the media browser modal to use only these view modes. W00t!


However, there are about 500 legacy nodes with previously-embedded images, most of which have been embedded using one of the default view modes. I can't just reconfigure those old view modes specifically for my use case, though (image style, custom fields, markup overrides, etc.), since they're used by other parts of the system.

Does anyone have any hints as to how I might go about programmatically changing - and then re-rendering - the media tags in these old pieces of content? I'd like to replace any pre-existing view modes with one of the custom view modes I'm using now: em_img_caption.

Currently using:

  • D7.36
  • File Entity 7.x-2.0-beta1+26-dev (2015-Mar-31)
  • Media 7.x-2.0-alpha4+30-dev (2015-Mar-31) with the following enabled: -- Media -- Media WYSIWYG -- Media WYSIWYG View Mode
  • Ckeditor Module 7.x-1.16+9-dev (2015-Apr-01) using Ckeditor 4.3.2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.