slick_devel.module in Slick extras 8
Same filename and directory in other branches
Provides options for the Slick development.
File
slick_devel/slick_devel.moduleView source
<?php
/**
* @file
* Provides options for the Slick development.
*/
/**
* Implements hook_library_info_alter().
*/
function slick_devel_library_info_alter(&$libraries, $module) {
$slick_path = drupal_get_path('module', 'slick');
$path = drupal_get_path('module', 'slick_devel');
$config = \Drupal::config('slick_devel.settings');
if ($config
->get('unminified')) {
// Switch to the un-minified version of the library.
if ($module == 'slick' && isset($libraries['slick'])) {
$path = 'libraries/slick';
if (function_exists('blazy_libraries_get_path')) {
if (blazy_libraries_get_path('slick') || blazy_libraries_get_path('slick-carousel')) {
$path = blazy_libraries_get_path('slick') ?: blazy_libraries_get_path('slick-carousel');
}
}
else {
if (!is_file(\Drupal::root() . $path . '/slick/slick.js')) {
$path = 'libraries/slick-carousel';
}
}
$libraries['slick']['js'] = [
'/' . $path . '/slick/slick.js' => [],
];
}
}
if ($config
->get('debug')) {
// Switch to the development version of the slick.load.js.
if ($module == 'slick' && isset($libraries['slick.load'])) {
$libraries['slick.load']['js'] = [
'/' . $slick_path . '/js/slick.load.js' => [],
];
}
}
else {
// Switch to the development version of the slick.load.js.
if ($config
->get('replace') && $module == 'slick' && isset($libraries['slick.load'])) {
$libraries['slick.load']['js'] = [
'/' . $path . '/js/slick.load.devel.js' => [],
];
}
}
if ($config
->get('disable')) {
// Disable the module slick.load.js.
if ($module == 'slick' && isset($libraries['slick.load'])) {
unset($libraries['slick.load']['js']);
}
}
}
Functions
Name | Description |
---|---|
slick_devel_library_info_alter | Implements hook_library_info_alter(). |