You are here

function juicebox_library_info_alter in Juicebox HTML5 Responsive Image Galleries 8.2

Implements hook_library_info_alter().

File

./juicebox.module, line 58
Module file for Juicebox.

Code

function juicebox_library_info_alter(&$libraries, $module) {
  if ($module != 'juicebox') {
    return;
  }

  // We don't currently have a way to process library details from Libraries
  // API automatically, so extract a core library definition manually.
  // see: https://www.drupal.org/node/2350877
  if (isset($libraries['juicebox'])) {
    $library = \Drupal::service('juicebox.formatter')
      ->getLibrary();
    if (!empty($library['installed']) && !empty($library['files']) && !empty($library['library path'])) {
      foreach ($library['files'] as $type => $file) {
        foreach ($file as $filename => $options) {
          $uri = '/' . $library['library path'] . '/' . $filename;
          $libraries['juicebox'][$type][$uri] = $options;
        }
      }
    }
  }
}