public function MasonryService::isMasonryInstalled in Masonry API 8
Check if the Masonry library is installed.
Return value
string|NULL The masonry library install path.
File
- src/
Services/ MasonryService.php, line 334 - Masonry service file.
Class
- MasonryService
- Wrapper methods for Masonry API methods.
Namespace
Drupal\masonry\ServicesCode
public function isMasonryInstalled() {
if (\Drupal::hasService('library.libraries_directory_file_finder')) {
$library_path = \Drupal::service('library.libraries_directory_file_finder')
->find('masonry/dist/masonry.pkgd.min.js');
}
elseif ($this->moduleHandler
->moduleExists('libraries')) {
$library_path = libraries_get_path('masonry') . '/dist/masonry.pkgd.min.js';
}
else {
$library_path = 'libraries/masonry/dist/masonry.pkgd.min.js';
}
return file_exists($library_path) ? $library_path : NULL;
}