You are here

function theme_oembed__video in oEmbed 7

Same name and namespace in other branches
  1. 7.0 theme/oembed.theme.inc \theme_oembed__video()

Theme for video oEmbed output.

File

theme/oembed.theme.inc, line 54
Theme related functions for oEmbed Core

Code

function theme_oembed__video($vars) {
  $embed = $vars['embed'];

  // Add query parameters from original URL back into the embed
  // HTML as YouTube ignores them when generating the oEmbed code.
  if ($embed['provider'] == 'default:youtube') {

    // Parse original URL and isolate the query.
    $parsed_url = drupal_parse_url($embed['original_url']);
    $query = $parsed_url['query'];

    // Remove video ID from query.
    unset($query['v']);

    // Build query string and insert it into the embed HTML..
    $query_string = drupal_http_build_query($query);
    $search = '?feature=oembed';
    $replace = $search . '&' . $query_string;
    $embed['html'] = str_replace($search, $replace, $embed['html']);
  }
  return $embed['html'];
}