1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/*
|
4 |
|
|
* Implements hook_requirements().
|
5 |
|
|
*/
|
6 |
|
|
function views_slideshow_cycle_requirements($phase) {
|
7 |
|
|
$requirements = array();
|
8 |
|
|
// Ensure translations do not break at install time
|
9 |
|
|
$t = get_t();
|
10 |
|
|
if ($phase == 'install' || $phase == 'runtime') {
|
11 |
|
|
if (!drupal_get_path('module', 'libraries')) {
|
12 |
|
|
$requirements['views_slideshow_cycle'] = array(
|
13 |
|
|
'title' => t('Libraries module missing'),
|
14 |
|
|
'severity' => REQUIREMENT_ERROR,
|
15 |
|
|
'value' => t('Libraries module required for Views Slideshow Cycle'),
|
16 |
|
|
'description' => $t('Views Slideshow Cycle module requires the <a href="@url">Libraries module</a> to be installed.', array('@url' => 'http://drupal.org/project/libraries')),
|
17 |
|
|
);
|
18 |
|
|
}
|
19 |
|
|
else {
|
20 |
|
|
if ($phase == 'install') {
|
21 |
|
|
$views_slideshow = drupal_get_path('module', 'views_slideshow_cycle');
|
22 |
|
|
require_once($views_slideshow . '/views_slideshow_cycle.module');
|
23 |
|
|
}
|
24 |
|
|
// Libraries module may not be installed,
|
25 |
|
|
// even if it is listed as dependency in .info file.
|
26 |
|
|
// For example, during installation from an installation profile
|
27 |
|
|
// Libraries will *not* be installed when hook_requirements get called
|
28 |
|
|
if (!function_exists('libraries_get_path')) {
|
29 |
|
|
include_once drupal_get_path('module', 'libraries') . '/libraries.module';
|
30 |
|
|
}
|
31 |
|
|
if (!$cycle_path = _views_slideshow_cycle_library_path()) {
|
32 |
|
|
$requirements['jquery.cycle'] = array(
|
33 |
|
|
'title' => t('jQuery Cycle Library'),
|
34 |
|
|
'severity' => REQUIREMENT_ERROR,
|
35 |
|
|
'value' => t('Library required for Views Slideshow Cycle'),
|
36 |
|
|
'description' => t('You need to install the jQuery cycle plugin. Create a directory in sites/all/libraries called jquery.cycle, and then copy jquery.cycle.all.min.js or jquery.cycle.all.js into it. You can find the plugin at !url.', array('!url' => l('http://malsup.com/jquery/cycle', 'http://malsup.com/jquery/cycle', array('attributes' => array('target' => '_blank'))))),
|
37 |
|
|
);
|
38 |
|
|
}
|
39 |
|
|
else {
|
40 |
|
|
$requirements['jquery.cycle'] = array(
|
41 |
|
|
'value' => t('Installed'),
|
42 |
|
|
'severity' => REQUIREMENT_OK,
|
43 |
|
|
);
|
44 |
|
|
}
|
45 |
|
|
}
|
46 |
|
|
$requirements['jquery.cycle']['title'] = t('jQuery Cycle Library');
|
47 |
|
|
}
|
48 |
|
|
return $requirements;
|
49 |
|
|
} |