You are here

public function SlickSkinManager::attachSkin in Slick Carousel 8.2

Provides skins only if required.

1 call to SlickSkinManager::attachSkin()
SlickSkinManager::attach in src/SlickSkinManager.php
Provides slick skins and libraries.

File

src/SlickSkinManager.php, line 302

Class

SlickSkinManager
Provides Slick skin manager.

Namespace

Drupal\slick

Code

public function attachSkin(array &$load, $attach = []) {
  if ($this
    ->config('slick_css')) {
    $load['library'][] = 'slick/slick.css';
  }
  if ($this
    ->config('module_css', 'slick.settings')) {
    $load['library'][] = 'slick/slick.theme';
  }
  if (!empty($attach['thumbnail_effect'])) {
    $load['library'][] = 'slick/slick.thumbnail.' . $attach['thumbnail_effect'];
  }
  if (!empty($attach['down_arrow'])) {
    $load['library'][] = 'slick/slick.arrow.down';
  }
  foreach ($this
    ->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;
    }
  }
}