You are here

function slick_get_media_overlay in Slick Carousel 7.2

Builds Youtube/ Vimeo overlay as file entity don't support nested file.

1 call to slick_get_media_overlay()
slick_format_media in includes/slick.media.inc
Formats image/media file data.

File

includes/slick.extras.inc, line 22
Contains optional functions called by frontend Media, or Field collection.

Code

function slick_get_media_overlay($url, $media_id) {
  if (strpos($url, 'youtu') !== FALSE) {
    $url = 'https://www.youtube.com/embed/' . $media_id;
    $scheme = 'youtube';
  }
  elseif (strpos($url, 'vimeo') !== FALSE) {
    $url = 'https://player.vimeo.com/video/' . $media_id;
    $scheme = 'vimeo';
  }
  return array(
    '#theme' => 'slick_image',
    '#item' => array(
      'embed_url' => $url,
      'scheme' => $scheme,
      'type' => 'video',
    ),
    '#settings' => array(
      'ratio' => '16:9',
      'current_display' => 'overlay',
      'content_attributes' => array(
        'width' => 640,
        'height' => 360,
      ),
    ),
  );
}