You are here

function christmas_lights_page_bottom in Christmas Lights 8

Implements hook_page_bottom().

File

./christmas_lights.module, line 11
Main file for the christmas_lights module.

Code

function christmas_lights_page_bottom(array &$page_bottom) {
  $settings = \Drupal::config('christmas_lights.settings')
    ->get();
  if (!$settings['enabled']) {
    return;
  }
  $time = Drupal::time()
    ->getRequestTime();
  if ($time >= $settings['start'] && $time <= $settings['end']) {
    $page_bottom['module']['#markup'] = '<div id="christmas-lights"></div>';
    $page_bottom['#attached']['library'][] = 'christmas_lights/christmas_lights';
  }
}