The new approach in 7.x-2.x doesn't check for additional view modes that could be injected by means of hook_media_wysiwyg_allowed_view_modes_alter leading to inability to match the view mode here:

    elseif ($tag_info['view_mode'] != 'default') {
      $file_entity_info = entity_get_info('file');
      if (!in_array($tag_info['view_mode'], array_keys($file_entity_info['view modes']))) {
        // Media 1.x defined some old view modes that have been superseded by
        // more semantically named ones in File Entity. The media_update_7203()
        // function updates field settings that reference the old view modes,
        // but it's impractical to update all text content, so adjust
        // accordingly here.
        static $view_mode_updates = array(
          'media_preview' => 'preview',
          'media_small' => 'teaser',
          'media_large' => 'full',
        );
        if (isset($view_mode_updates[$tag_info['view_mode']])) {
          $tag_info['view_mode'] = $view_mode_updates[$tag_info['view_mode']];
        }
        else {
          throw new Exception('Invalid view mode');
        }
      }
    }

A patch will follow.

CommentFileSizeAuthor
#1 wysiwyg-view-modes-1921384-1.patch1.72 KBlex0r

Comments

lex0r’s picture

StatusFileSize
new1.72 KB

The patch.

gmclelland’s picture

Status: Active » Needs review

Setting this to "needs review" since a patch is attached.

Status: Needs review » Needs work

The last submitted patch, wysiwyg-view-modes-1921384-1.patch, failed testing.

Anonymous’s picture

Issue summary: View changes

Typo fixed.

dave reid’s picture

Component: WYSIWYG integration » Media WYSIWYG
Issue summary: View changes
chris matthews’s picture

Status: Needs work » 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