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.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | wysiwyg-view-modes-1921384-1.patch | 1.72 KB | lex0r |
Comments
Comment #1
lex0r commentedThe patch.
Comment #2
gmclelland commentedSetting this to "needs review" since a patch is attached.
Comment #3.0
(not verified) commentedTypo fixed.
Comment #4
dave reidComment #5
chris matthews commentedClosing 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