You are here

background_video.module in Background Video 8

Same filename and directory in other branches
  1. 7 background_video.module

File

background_video.module
View source
<?php

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function background_video_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.background_video':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('This Background Video module allows to play video in the background of the page. To play video background in the background what you have to do is just specify the name of the class to which you want to add the background video. There are some other specification like Loop the video, where to place the controls like play/pause and mute/unmute etc.') . '</p>';
      return $output;
  }
}

/**
 * Implements hook_page_attachments().
 */
function background_video_page_attachments(array &$attachments) {

  /** @var \Drupal\background_video\Manager\BackgroundVideoManager $manager */
  $manager = \Drupal::service('background_video.manager');

  // Pass the BackgroundVideoManager settings.
  $attachments['#attached']['drupalSettings']['background_video'] = $manager
    ->getJsSettings();

  //var_dump($attachments['#attached']);

  // Load the Background Video js library.
  $attachments['#attached']['library'][] = 'background_video/background_video';
}