You are here

public function ElevateZoomPlusManager::libraryInfoAlter in ElevateZoom Plus 8

Implements hook_library_info_alter().

File

src/ElevateZoomPlusManager.php, line 56

Class

ElevateZoomPlusManager
Provides ElevateZoom Plus library methods mainly for hooks.

Namespace

Drupal\elevatezoomplus

Code

public function libraryInfoAlter(&$libraries, $extension) {
  $library = elevatezoomplus_libraries_get_path('elevatezoom-plus') ?: elevatezoomplus_libraries_get_path('ez-plus');
  if ($library) {
    $ext = is_file($library . '/src/jquery.ez-plus.min.js') ? 'min.js' : 'js';
    $libraries['elevatezoomplus']['js']['/' . $library . '/src/jquery.ez-plus.' . $ext] = [
      'weight' => -5,
    ];

    // Due to soft dependencies.
    if ($this->manager
      ->getModuleHandler()
      ->moduleExists('splide')) {
      $libraries['load']['dependencies'][] = 'splide/load';
      $libraries['load']['dependencies'][] = 'splide/nav';
    }
    if ($this->manager
      ->getModuleHandler()
      ->moduleExists('slick')) {
      $libraries['load']['dependencies'][] = 'slick/slick.load';
    }
  }
}