You are here

christmas_lights.module in Christmas Lights 8

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

Main file for the christmas_lights module.

File

christmas_lights.module
View source
<?php

/**
 * @file
 * Main file for the christmas_lights module.
 */

/**
 * Implements hook_page_bottom().
 */
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';
  }
}

Functions