When using the wysiwyg editor and inserting a media object, the editor shows some helpful classes are assigned to the media object. Specifically, the view mode and the media object id. However, when the "convert media tag to markup" filter is applied, these classes are not added to the markup produced. The information about the view mode would be especially helpful as a class on the html element created.

I propose the following simple change to the media.filter.inc file, beginning after line 183:

if (isset($tag_info['view_mode'])) {
  $tag_info['attributes']['class'][] = $tag_info['view_mode'];
}

This adds the view mode as a class. I tested this on a dev site I'm working on and it appears to work without issue for images inserted via a wysiwyg editor. Not certain how this would affect other types of media, but I'm most concerned about images at the moment. Perhaps the maintainers would be interested in adding (something like) this for the 7x-1x or 7x-2x tracks of this project?

Comments

Chris Matthews’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Component: WYSIWYG integration » Code
Issue summary: View changes
Status: Active » Closed (outdated)

Closing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team