slick_test.module in Slick Carousel 8.2
Same filename and directory in other branches
Testing Slick.
File
tests/modules/slick_test/slick_test.moduleView source
<?php
/**
* @file
* Testing Slick.
*/
/**
* Implements hook_theme().
*/
function slick_test_theme() {
return [
'slick_test' => [
'render element' => 'element',
],
];
}
/**
* Prepares variables for slick-test.html.twig templates.
*/
function template_preprocess_slick_test(&$variables) {
$element = $variables['element'];
$variables['content'] = $element['#children'];
$variables['settings'] = isset($element['#settings']) ? $element['#settings'] : [];
}
/**
* Implements hook_library_info_alter().
*/
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']);
}
}
}
Functions
Name | Description |
---|---|
slick_test_library_info_alter | Implements hook_library_info_alter(). |
slick_test_theme | Implements hook_theme(). |
template_preprocess_slick_test | Prepares variables for slick-test.html.twig templates. |