public function SlickSkinManager::attach in Slick Carousel 8.2
Provides slick skins and libraries.
File
- src/
SlickSkinManager.php, line 258
Class
- SlickSkinManager
- Provides Slick skin manager.
Namespace
Drupal\slickCode
public function attach(array &$load, array $attach = []) {
if (!empty($attach['lazy'])) {
$load['library'][] = 'blazy/loading';
}
// Load optional easing library.
if ($this
->getEasingPath()) {
$load['library'][] = 'slick/slick.easing';
}
if (!empty($attach['_vanilla'])) {
$load['library'][] = 'slick/vanilla';
}
// Allows Slick initializer to be disabled by a special flag _unload.
if (empty($attach['_unload'])) {
$load['library'][] = 'slick/slick.load';
}
else {
if ($this
->config('slick_css')) {
$load['library'][] = 'slick/slick.css';
}
}
foreach ([
'colorbox',
'mousewheel',
] as $component) {
if (!empty($attach[$component])) {
$load['library'][] = 'slick/slick.' . $component;
}
}
if (!empty($attach['skin'])) {
$this
->attachSkin($load, $attach);
}
// Attach default JS settings to allow responsive displays have a lookup,
// excluding wasted/trouble options, e.g.: PHP string vs JS object.
$excludes = explode(' ', 'mobileFirst appendArrows appendDots asNavFor prevArrow nextArrow respondTo pauseIcon playIcon');
$excludes = array_combine($excludes, $excludes);
$load['drupalSettings']['slick'] = array_diff_key(Slick::defaultSettings(), $excludes);
}