You are here

function lightning_scheduler_library_info_alter in Lightning Workflow 8.2

Same name and namespace in other branches
  1. 8.3 modules/lightning_scheduler/lightning_scheduler.module \lightning_scheduler_library_info_alter()

Implements hook_library_info_alter().

File

modules/lightning_scheduler/lightning_scheduler.module, line 18

Code

function lightning_scheduler_library_info_alter(array &$libraries, $extension) {
  if ($extension === 'seven') {
    $dir = drupal_get_path('module', 'lightning_scheduler');
    $libraries['lightning_scheduler.widget'] = [
      'css' => [
        'theme' => [
          // @TODO This will break if the site is running in a subdirectory.
          "/{$dir}/css/component.seven.css" => [],
        ],
      ],
    ];
  }

  // Import React's testing utilities if Lightning Dev is enabled. This is
  // necessary in order for Behat tests to pass.
  if (Drupal::moduleHandler()
    ->moduleExists('lightning_dev') && $extension === 'lightning_scheduler') {
    $libraries['react']['js']['https://unpkg.com/react-dom@16.3.2/umd/react-dom-test-utils.production.min.js'] = [
      'external' => TRUE,
      'attributes' => [
        'integrity' => 'sha384-7jjA9Du+a2tQZfn0Rzzz4xsYIwnft+l09jw6BUpA21gsQNj+0x2yLq77a7mvqwWl',
        'crossorigin' => 'anonymous',
      ],
    ];
  }
}