I recently came across the same issue that was described in #1904844: Video field renderer outputs junk data if the video_embed_field is empty. The difference between my issue and that one is that that should only be applying to empty fields. However, even after applying the patch, I am experiencing the same error even when my field has a url saved to it.
I realized that the reason this is occurring is because the $variables
array is not being built correctly. However, this only happens when I'm using a colorbox. When I'm just embedding the video directly into the page, the video renders fine.
This seems to be because when using colorbox, $variables['url']
is being set at null, and therefore the following code is returning nothing for the embed_code.
if (!empty($variables['url'])) {
// Prepare the URL
if (!stristr($variables['url'], 'http://') && !stristr($variables['url'], 'https://')) {
$variables['url'] = 'http://' . $variables['url']; }
// Prepare embed code
if ($handler && isset($handler['function']) && function_exists($handler['function'])) {
$embed_code = call_user_func($handler['function'], $variables['url'], $variables['style_settings']);
$variables['embed_code'] = drupal_render($embed_code);
}
else {
$variables['embed_code'] = l($variables['url'], $variables['url']);
}
} else {
$variables['embed_code'] = '';
}
I'm not sure exactly how to fix this, so any help would be greatly appreciated.
Comments
Comment #1
mrweiner CreditAttribution: mrweiner commentedTurns out that this was a conflict with a patched version of the Redirect module at #905914: Merge global redirect functions into Redirect module. With the patch removed it works just fine.
Comment #1.0
mrweiner CreditAttribution: mrweiner commentedFixed referenced issue number.