You are here

varbase_heroslider_media.module in Media Hero Slider 8.4

The varbase_heroslider_media module.

File

varbase_heroslider_media.module
View source
<?php

/**
 * @file
 * The varbase_heroslider_media module.
 */

/**
 * Implements hook_page_attachments().
 */
function varbase_heroslider_media_page_attachments(array &$attachments) {
  $attachments['#attached']['library'][] = 'varbase_heroslider_media/general-styling';
  $attachments['#attached']['library'][] = 'varbase_heroslider_media/vimeo-player';
  $attachments['#attached']['library'][] = 'varbase_heroslider_media/youtube-player';
  $attachments['#attached']['library'][] = 'varbase_heroslider_media/general-scripts';
}

/**
 * Implements hook_preprocess_video_embed_iframe__youtube().
 */
function varbase_heroslider_media_preprocess_video_embed_iframe__youtube(&$variables) {

  // Hide youtube logo and controls
  $variables['attributes']['id'] = "youtubeVideo";
  $variables['query']['modestbranding'] = '0';
  $variables['query']['enablejsapi'] = '1';
  $variables['query']['showinfo'] = '0';
  $variables['query']['controls'] = '0';
}

/**
 * Implements hook_preprocess_video_embed_iframe__youtube_playlist().
 */
function varbase_heroslider_media_preprocess_video_embed_iframe__youtube_playlist(&$variables) {

  // Hide youtube logo and controls if playlist url is choose
  $variables['attributes']['id'] = "youtubeVideo";
  $variables['query']['modestbranding'] = '0';
  $variables['query']['enablejsapi'] = '1';
  $variables['query']['showinfo'] = '0';
  $variables['query']['controls'] = '0';
}

/**
 * Implements hook_preprocess_video_embed_iframe__vimeo().
 */
function varbase_heroslider_media_preprocess_video_embed_iframe__vimeo(&$variables) {

  // Hide Vimeo play control.
  $variables['query']['background'] = 1;

  // Prevent vedio autoplay.
  $variables['query']['autoplay'] = 0;

  // Stop Vimeo vedio from looping.
  $variables['query']['loop'] = 0;
}