You are here

public function MasonryService::isImagesloadedInstalled in Masonry API 8

Check if the ImagesLoaded library is installed.

Return value

string|NULL The imagesloaded library install path.

File

src/Services/MasonryService.php, line 355
Masonry service file.

Class

MasonryService
Wrapper methods for Masonry API methods.

Namespace

Drupal\masonry\Services

Code

public function isImagesloadedInstalled() {
  if (\Drupal::hasService('library.libraries_directory_file_finder')) {
    $library_path = \Drupal::service('library.libraries_directory_file_finder')
      ->find('imagesloaded/imagesloaded.pkgd.min.js');
  }
  elseif ($this->moduleHandler
    ->moduleExists('libraries')) {
    $library_path = libraries_get_path('imagesloaded') . '/imagesloaded.pkgd.min.js';
  }
  else {
    $library_path = 'libraries/imagesloaded/imagesloaded.pkgd.min.js';
  }
  return file_exists($library_path) ? $library_path : NULL;
}