background_video.module in Background Video 8
File
background_video.module
View source
<?php
use Drupal\Core\Routing\RouteMatchInterface;
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;
}
}
function background_video_page_attachments(array &$attachments) {
$manager = \Drupal::service('background_video.manager');
$attachments['#attached']['drupalSettings']['background_video'] = $manager
->getJsSettings();
$attachments['#attached']['library'][] = 'background_video/background_video';
}