splide-1.0.x-dev/splide.install
splide.install
<?php
/**
* @file
* Installation actions for Splide.
*/
/**
* Implements hook_requirements().
*/
function splide_requirements($phase) {
if ($phase != 'runtime') {
return [];
}
$exists = FALSE;
/* @phpstan-ignore-next-line */
$path = splide('skin')->getSplidePath();
if ($path && is_dir($path)) {
$exists = is_file($path . '/dist/js/splide.min.js');
}
return [
'splide_library' => [
'title' => t('Splide library'),
'description' => $exists ? '' : t('The <a href=":url">Splide library</a> should be installed at <strong>/libraries/splidejs--splide/dist/js/splide.min.js</strong>, or <strong>/libraries/splide/dist/js/splide.min.js</strong>, or any path supported by core library finder ot libraries.module if installed. Check out file or folder permissions if troubled.', [':url' => 'https://github.com/Splidejs/splide']),
'severity' => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
'value' => $exists ? t('Installed') : t('Not installed'),
],
];
}
/**
* Implements hook_uninstall().
*/
function splide_uninstall() {
blazy_filter_cleanup('splide');
}
