You are here

function video_embed_youku_handle_video in Video Embed Youku 7

Handler for Youku videos.

Parameters

string $url: The video URL.

array $settings: The settings array.

Return value

string|bool The video iframe, or FALSE in case the ID can't be retrieved from the URL.

1 string reference to 'video_embed_youku_handle_video'
video_embed_youku_video_embed_handler_info in ./video_embed_youku.module
Implements hook_video_embed_handler_info().

File

./video_embed_youku.module, line 89
Adds a handler for Youku videos to Video Embed Field.

Code

function video_embed_youku_handle_video($url, $settings) {
  $id = _video_embed_youku_get_video_id($url);
  if ($id) {

    // Our embed code.
    $embed = '<iframe src="https://player.youku.com/embed/!id" width="!width" height="!height" frameborder=0 allowfullscreen></iframe> ';

    // Use format_string to replace our placeholders with the settings values.
    $embed = format_string($embed, array(
      '!id' => $id,
      '!width' => $settings['width'],
      '!height' => $settings['height'],
    ));
    $video = array(
      '#markup' => $embed,
    );
    return $video;
  }
  return FALSE;
}