diff --git a/video_embed_field.module b/video_embed_field.module index 8f25a71..b8d89b0 100755 --- a/video_embed_field.module +++ b/video_embed_field.module @@ -347,19 +347,22 @@ function template_preprocess_video_embed_field_embed_code(&$variables) { $variables['style_settings'] = $handler['defaults']; } + if (!empty($variables['url'])) { + // Prepare the URL + if (!stristr($variables['url'], 'http://') && !stristr($variables['url'], 'https://')) { + $variables['url'] = 'http://' . $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']); + // 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'] = ''; } // Prepare video data