function content_browser_requirements in Content Browser 8
Implements hook_requirements().
File
- ./
content_browser.install, line 85 - Defines install routines for Content Browser.
Code
function content_browser_requirements($phase) {
$requirements = [];
// Optionally use the Libraries module to determine our library path.
if (\Drupal::moduleHandler()
->moduleExists('libraries')) {
$masonry_path = libraries_get_path('masonry') . '/dist/masonry.pkgd.min.js';
}
else {
$masonry_path = DRUPAL_ROOT . '/libraries/masonry/dist/masonry.pkgd.min.js';
}
if (!file_exists($masonry_path)) {
$requirements['masonry'] = [
'title' => t('Masonry library missing'),
'description' => t('Content Browser requires the Masonry library. Download the newest release from
https://github.com/desandro/masonry/releases and place it in /libraries'),
'severity' => REQUIREMENT_ERROR,
];
}
return $requirements;
}