-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfield_slideshow.install
More file actions
85 lines (79 loc) · 3.25 KB
/
field_slideshow.install
File metadata and controls
85 lines (79 loc) · 3.25 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* @file
* Install, update and uninstall functions for the Field Slideshow module.
*/
use Drupal\Core\Url;
/**
* Implements hook_schema().
*/
function field_slideshow_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$path = '';
if ($path == '') {
$path = DRUPAL_ROOT . '/libraries/jquery.cycle';
}
if (file_exists($path . '/jquery.cycle.all.min.js') || file_exists($path . '/jquery.cycle.all.js')) {
$requirements['field_slideshow_cycle_plugin'] = array(
'title' => t('JQuery Cycle plugin'),
'severity' => REQUIREMENT_OK,
'value' => t('Installed'),
);
}
else {
$url = Url::fromUri('http://jquery.malsup.com/cycle/download.html');
$requirements['field_slideshow_cycle_plugin'] = array(
'title' => t('JQuery Cycle plugin'),
'value' => t('Not found'),
'severity' => REQUIREMENT_ERROR,
'description' => t('You need to download the %name and move the downloaded js file(s) into the %path folder of your server.', array('%name' => \Drupal::l(t('JQuery Cycle plugin'), $url), '%path' => $path)),
);
}
}
// @todo Carousel code to be fixed
$carousel_used = FALSE;
if ($carousel_used) {
$path = '';
if ($path == '') {
$path = DRUPAL_ROOT . '/libraries/jquery.jcarousel';
}
if (file_exists($path . '/lib/jquery.jcarousel.min.js') || file_exists($path . '/lib/jquery.jcarousel.js')) {
$requirements['field_slideshow_jcarousel_plugin'] = array(
'title' => t('JCarousel plugin'),
'severity' => REQUIREMENT_OK,
'value' => t('Installed'),
);
}
else {
$url = Url::fromUri('http://sorgalla.com/jcarousel/');
$requirements['field_slideshow_jcarousel_plugin'] = array(
'title' => t('JCarousel plugin'),
'value' => t('Not found'),
'severity' => REQUIREMENT_ERROR,
'description' => t('You need to download the %name and move the content of the downloaded folder into the %path folder of your server. When this is done there should be a file sites/all/libraries/jquery.jcarousel/lib/jquery.jcarousel.js, or jquery.jcarousel.min.js', array('%name' => \Drupal::l(t('JCarousel plugin'), $url), '%path' => $path)),
);
}
}
$path = '';
if ($path == '') {
$path = DRUPAL_ROOT . '/libraries/jquery.imagesloaded';
}
if (file_exists($path . '/jquery.imagesloaded.min.js') || file_exists($path . '/jquery.imagesloaded.js')) {
$requirements['field_slideshow_imagesloaded_plugin'] = array(
'title' => t('JQuery ImagesLoaded plugin'),
'severity' => REQUIREMENT_OK,
'value' => t('Installed'),
);
}
else {
$url = Url::fromUri('https://github.com/desandro/imagesloaded/downloads');
$requirements['field_slideshow_imagesloaded_plugin'] = array(
'title' => t('JQuery ImagesLoaded plugin'),
'value' => t('Not found'),
'severity' => REQUIREMENT_WARNING,
'description' => t('For best results, you should download the %name and move the downloaded js file(s) into the %path folder of your server.', array('%name' => \Drupal::l(t('JQuery ImagesLoaded plugin'), $url), '%path' => $path)),
);
}
return $requirements;
}