function oembed_pre_render_wysiwyg in oEmbed 7.0
Converts oEmbed response to a plain image.
This is here for Media module WYSIWYG support. When a video or image is added to a text area, this step makes sure the WYSIWYG receives an image to stand in for the real media. It must be an actual img element.
1 string reference to 'oembed_pre_render_wysiwyg'
- oembed_element_info in ./
oembed.module - Implements hook_element_info().
File
- ./
oembed.module, line 422
Code
function oembed_pre_render_wysiwyg($element) {
// Only act when the oEmbed response is true.
if (!empty($element['#printed'])) {
return $element;
}
$embed = $element['#embed'];
if ($embed['type'] == 'photo') {
oembed_pre_render_image_helper($element);
}
else {
$element = oembed_pre_render_thumbnail($element);
}
// oembed_pre_render_image() sets #printed to TRUE when there's no
// thumbnail to render.
if (!empty($element['#printed']) && !isset($element['#path'])) {
$element['#theme'] = 'media_formatter_large_icon';
$element['#printed'] = FALSE;
// To select an icon, there must be a file object.
if (!isset($element['#file'])) {
$element['#file'] = oembed_url_to_file($element['#url']);
}
}
return $element;
}