You are here

function hook_media_embed_wisiwyg_view_mode_alter in Media WYSIWYG Embed 7

Alter view mode the file will be displayd in when formatter doesn't render the file for the WYSIWYG mode.

Some formatters don't render files for the WYSIWYG mode. In this case we just render the file in a specified view mode.

Parameters

string $view_mode: A view mode. Defaults to "default".

object $file: A file entity.

See also

media_embed_formatted_wysiwyg()

1 invocation of hook_media_embed_wisiwyg_view_mode_alter()
media_embed_formatted_wysiwyg in ./media_embed.module
Returns formatted media item markup for WYSIWYG.

File

./media_embed.api.php, line 96
Hooks provided by the Media WYSIWYG Embed module.

Code

function hook_media_embed_wisiwyg_view_mode_alter(&$view_mode, $file) {
  if ('video' == $file->type) {
    $view_mode = 'preview';
  }
}