You are here

function background_video_page_attachments in Background Video 8

Implements hook_page_attachments().

File

./background_video.module, line 23

Code

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';
}