function slick_requirements in Slick Carousel 8
Same name and namespace in other branches
- 8.2 slick.install \slick_requirements()
- 7.3 slick.install \slick_requirements()
- 7.2 slick.install \slick_requirements()
Implements hook_requirements().
File
- ./
slick.install, line 11 - Installation actions for Slick.
Code
function slick_requirements($phase) {
if ($phase != 'runtime') {
return [];
}
$path = DRUPAL_ROOT . '/libraries/slick/slick/slick.min.js';
if (function_exists('libraries_get_path')) {
$library_path = libraries_get_path('slick') ?: libraries_get_path('slick-carousel');
if ($library_path) {
$path = $library_path . '/slick/slick.min.js';
}
}
$exists = is_file($path);
return [
'slick_library' => [
'title' => t('Slick library'),
'description' => $exists ? '' : t('The <a href=":url">Slick library</a> should be installed at <strong>/libraries/slick/slick/slick.min.js</strong>, or any path supported by libraries.module if installed.', [
':url' => 'https://github.com/kenwheeler/slick/',
]),
'severity' => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
'value' => $exists ? t('Installed') : t('Not installed'),
],
];
}