You are here

function slick_library_info_alter in Slick Carousel 8

Same name and namespace in other branches
  1. 8.2 slick.module \slick_library_info_alter()

Implements hook_library_info_alter().

File

./slick.module, line 70
Slick carousel integration, the last carousel you'll ever need.

Code

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,
        ],
      ];
    }
  }
}