-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswiper.install
More file actions
executable file
·55 lines (51 loc) · 1.49 KB
/
swiper.install
File metadata and controls
executable file
·55 lines (51 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* @file
* Installation actions for Swiper.
*/
/**
* Implements hook_uninstall().
*
* Deletes all content and configuration installed by this module.
*/
function swiper_uninstall() {
// Delete all of the configuration installed by this module.
$dir = drupal_get_path('module', 'swiper') . '/config/install';
$files = file_scan_directory($dir, '/.*/');
foreach ($files as $file) {
\Drupal::configFactory()->getEditable($file->name)->delete();
}
\Drupal::logger('swiper')->info(t('Deleted swiper configuration'), []);
}
/**
* Implements hook_requirements().
*/
function swiper_requirements($phase) {
$requirements = [];
// Check to see if the swiper library is available.
if ($phase == 'runtime') {
// @TODO replace libraries_detect function.
$library = libraries_detect('swiper');
if ($library && !empty($library['installed'])) {
if ($library['version']) {
$description = t('Version %i installed', ['%i' => $library['version']]);
}
else {
$description = t('Unable to detect version.');
}
$requirements['swiper'] = [
'title' => t('Swiper'),
'description' => $description,
'severity' => REQUIREMENT_OK,
];
}
else {
$requirements['swiper'] = [
'title' => t('Swiper'),
'description' => t('Swiper library not found. Please consult the README.md for installation instructions.'),
'severity' => REQUIREMENT_ERROR,
];
}
}
return $requirements;
}