I'm relatively new to this module and have been using it for a short while. As a site editor I often add media to a wysiwyg field (like node body) after choosing the view mode for the media, which directs the properties of usage. However, I think there would be instances where I would like to override the properties of the media such as alt & title text, or perhaps even the height and width of an image for example. I wouldn't want to create a separate file view mode just for that one instance. Nor would I want to overwrite the file's properties (alt & title) since its a one-off.

Would it be great to have a small icon placed on top of media inserted into a wysiwyg field, such that clicking on the icon would bring up a form to edit the properties of that media instance alone?

This is very similar to #1291518: Use Field Formatters for Embedding Options, however it applies for the current instance of usage only, not the actual file entity or file view mode.

In effect, the main things that I think is needed for this is:

  1. JS (e.g. media.image-instance.overlay.js) to add edit-icon on embedded media, which on-click pops up a media instance edit form
  2. Menu callback for the above form that, based on the file mime returns form with appropriate fields (like alt, height, title etc.)
  3. In wysiwyg-media.js: Add a new element called 'instanceoverrides' to the tagContent variable when creating the JSON in the 'detach' function:
    tagContent = {
         "type": 'media',
          "instanceOverrides": instOver,
          // @todo: This will be selected from the format form
          "view_mode": attributes['view_mode'].value,
          "fid" : attributes['fid'].value,
          "attributes": mediaAttributes
        };
  4. media.image-instance.overlay.js to convert submitted form values of the instance edit form into the tagmap. Sample js for this is attached.
  5. <?php
    function media_token_to_markup() {}
    ?>
    in media.filter.inc to consider the 'instanceOverrides' property in $tag_info and merge it with $settings, such that the instanceOverrides take priority.
  6. Now, users can examine the file object during load, and it should have the values of the instanceOverrides in the
    <?php
    $file
    ->override
    ?>
    array and can be used in the appropriate tpl.

I believe this would add value to the good work done in this module so far.

Files: 

Comments

#1307054: Media browser missing image alt and title fields (or actually, #1553094: Alt and Title support for Images I think) does solve part of the problem of being able to override alt/title attributes fgor an individual embedded media instance. But, I think this ticket is about more than that. This is about being able to edit a media embed after embedding it. Currently, once you have embedded the image there is no way to edit it's properties at all. What if you made a mistake when typing the alt or title text. What if you selected the wrong image style? How do you edit those things? Currently the only way to do this is to delete the embedded image, and re-embed. It's a very bad usability issue.

The idea of having a small icon placed on top of media inserted into a wysiwyg field, such that clicking on the icon would bring up a form to edit the properties of that media instance would solve this problem very nicely. Either that, or a contextual menu that you get by right clicking on the image, with an 'edit' option which brings up the settings for the media instance.

Yes I'm more in line with @mrfelton

Status:Active» Closed (duplicate)

Status:Closed (duplicate)» Active

Hi,
Is this issue resolved? I have installed latest dev relase of media module but after embedding an image inside editor, I can not see any option to edit the image back - for example to change it's style. I am missing something? Thank you