You are here

function video_embed_field_handle_vimeo in Video Embed Field 7.2

Same name and namespace in other branches
  1. 7 video_embed_field.module \video_embed_field_handle_vimeo()

Handler for Vimeo videos.

Parameters

string $url: The video URL.

array $settings: The settings array.

Return value

string The video iframe.

1 string reference to 'video_embed_field_handle_vimeo'
video_embed_field_video_embed_handler_info in ./video_embed_field.handlers.inc
Implements hook_video_embed_handler_info().

File

./video_embed_field.handlers.inc, line 499
Provide some handlers for video embed field Other modules can implement the hook_video_embed_handler_info to provide more handlers.

Code

function video_embed_field_handle_vimeo($url, $settings) {
  $vimeo_data = _video_embed_field_get_vimeo_data($url);

  // Get ID of video from URL.
  $id = _video_embed_field_get_vimeo_id($vimeo_data);
  if (empty($id)) {
    return array(
      '#markup' => l($url, $url),
    );
  }

  // Construct the embed code.
  $settings['player_id'] = drupal_html_id('vimeo-' . $id);
  if (!empty($settings['froogaloop'])) {
    $settings['api'] = 1;
  }
  unset($settings['froogaloop']);

  // Add class to variable to avoid adding it to URL param string.
  $class = $settings['class'];
  unset($settings['class']);
  $settings_str = _video_embed_code_get_settings_str($settings);
  return array(
    '#markup' => '<iframe class="' . check_plain($class) . '" id="' . $settings['player_id'] . '" width="' . check_plain($settings['width']) . '" height="' . check_plain($settings['height']) . '" src="//player.vimeo.com/video/' . $id . '?' . $settings_str . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>',
  );
}