slick.module in Slick Carousel 8
Same filename and directory in other branches
Slick carousel integration, the last carousel you'll ever need.
File
slick.moduleView source
<?php
/**
* @file
* Slick carousel integration, the last carousel you'll ever need.
*/
use Drupal\blazy\Blazy;
use Drupal\slick\SlickDefault;
/**
* Implements hook_theme().
*/
function slick_theme() {
$themes = [];
$all = [
'slick',
'slide',
'grid',
'image',
'thumbnail',
'vanilla',
'wrapper',
];
foreach ($all as $item) {
$key = $item == 'slick' ? $item : 'slick_' . $item;
$themes[$key] = [
'render element' => 'element',
'file' => 'templates/slick.theme.inc',
];
}
return $themes;
}
/**
* Implements hook_library_info_build().
*/
function slick_library_info_build() {
return \Drupal::service('slick.manager')
->libraryInfoBuild();
}
/**
* Implements hook_config_schema_info_alter().
*/
function slick_config_schema_info_alter(array &$definitions) {
Blazy::configSchemaInfoAlter($definitions, 'slick_base', SlickDefault::extendedSettings());
}
/**
* Implements hook_field_formatter_info_alter().
*/
function slick_field_formatter_info_alter(array &$info) {
// Supports Media Entity via VEM within VEF if available.
if (\Drupal::moduleHandler()
->moduleExists('video_embed_media')) {
$info['slick_file'] = [
'id' => 'slick_file',
'label' => t('Slick Image with Media'),
'description' => t('Display the images associated to VEM/ME as a simple mix of Slick image/video carousel.'),
'class' => 'Drupal\\slick\\Plugin\\Field\\FieldFormatter\\SlickFileFormatter',
'field_types' => [
'entity_reference',
'image',
],
'quickedit' => [
'editor' => 'disabled',
],
'provider' => 'slick',
];
}
}
/**
* Implements hook_hook_info().
*/
function slick_hook_info() {
$hooks['slick_skins_info'] = [
'group' => 'slick',
];
return $hooks;
}
/**
* Implements hook_library_info_alter().
*/
function slick_library_info_alter(&$libraries, $extension) {
if ($extension === 'slick' && function_exists('libraries_get_path')) {
$library_path = libraries_get_path('slick') ?: libraries_get_path('slick-carousel');
if ($library_path) {
$libraries['slick']['js'] = [
'/' . $library_path . '/slick/slick.min.js' => [
'weight' => -3,
],
];
$libraries['slick']['css']['base'] = [
'/' . $library_path . '/slick/slick.css' => [],
];
$libraries['slick.css']['css']['theme'] = [
'/' . $library_path . '/slick/slick-theme.css' => [],
];
}
$library_easing = libraries_get_path('easing') ?: libraries_get_path('jquery.easing');
if ($library_easing) {
$easing_path = $library_easing . '/jquery.easing.min.js';
// Composer via bower-asset puts the library within `js` directory.
if (!is_file($easing_path)) {
$easing_path = $library_easing . '/js/jquery.easing.min.js';
}
$libraries['slick.easing']['js'] = [
'/' . $easing_path => [
'weight' => -4,
],
];
}
$library_mousewheel = libraries_get_path('mousewheel') ?: libraries_get_path('jquery-mousewheel');
if ($library_mousewheel) {
$libraries['slick.mousewheel']['js'] = [
'/' . $library_mousewheel . '/jquery.mousewheel.min.js' => [
'weight' => -4,
],
];
}
}
}
Functions
Name | Description |
---|---|
slick_config_schema_info_alter | Implements hook_config_schema_info_alter(). |
slick_field_formatter_info_alter | Implements hook_field_formatter_info_alter(). |
slick_hook_info | Implements hook_hook_info(). |
slick_library_info_alter | Implements hook_library_info_alter(). |
slick_library_info_build | Implements hook_library_info_build(). |
slick_theme | Implements hook_theme(). |