function slick_test_library_info_alter in Slick Carousel 8.2
Implements hook_library_info_alter().
File
- tests/
modules/ slick_test/ slick_test.module, line 28 - Testing Slick.
Code
function slick_test_library_info_alter(array &$libraries, $extension) {
if ($extension === 'slick') {
$path = \Drupal::root() . '/libraries/slick/slick/slick.min.js';
if (!is_file($path)) {
$libraries['slick']['js'] = [
'https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js' => [
'type' => 'external',
'weight' => -4,
],
];
unset($libraries['slick']['js']['/libraries/slick/slick/slick.min.js']);
}
}
}