public function SlickManager::attachSkin in Slick Carousel 7.3
Same name and namespace in other branches
- 8.2 src/SlickManager.php \Drupal\slick\SlickManager::attachSkin()
- 8 src/SlickManager.php \Drupal\slick\SlickManager::attachSkin()
Provides skins only if required.
1 call to SlickManager::attachSkin()
- SlickManager::attach in src/
SlickManager.php - Returns array of needed assets suitable for #attached property.
File
- src/
SlickManager.php, line 137
Class
- SlickManager
- Implements SlickManagerInterface.
Namespace
Drupal\slickCode
public function attachSkin(array &$load, $attach = []) {
if ($this
->config('slick_css', TRUE)) {
$load['library'][] = [
'slick',
'css',
];
}
if ($this
->config('module_css', TRUE)) {
$load['library'][] = [
'slick',
'theme',
];
}
if (!empty($attach['thumbnail_effect'])) {
$load['library'][] = [
'slick',
'thumbnail.' . $attach['thumbnail_effect'],
];
}
if (!empty($attach['down_arrow'])) {
$load['library'][] = [
'slick',
'arrows.down',
];
}
foreach (self::getConstantSkins() as $group) {
$skin = $group == 'main' ? $attach['skin'] : (isset($attach['skin_' . $group]) ? $attach['skin_' . $group] : '');
if (!empty($skin)) {
$skins = $this
->getSkinsByGroup($group);
$provider = isset($skins[$skin]['provider']) ? $skins[$skin]['provider'] : 'slick';
$load['library'][] = [
'slick',
$provider . '.' . $group . '.' . $skin,
];
}
}
}