Projet

Général

Profil

Paste
Télécharger (2,44 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views_slideshow / contrib / views_slideshow_cycle / views_slideshow_cycle.install @ b433176d

1
<?php
2

    
3
/**
4
 * @file
5
 * Install/requirements functions for Views Slideshow: Cycle.
6
 */
7

    
8
/**
9
 * Implements hook_requirements().
10
 */
11
function views_slideshow_cycle_requirements($phase) {
12
  $requirements = array();
13

    
14
  // If installing via Drush skip requirement checking here.
15
  if (php_sapi_name() == 'cli') {
16
    return $requirements;
17
  }
18

    
19
  // Ensure translations do not break at install time.
20
  $t = get_t();
21
  if ($phase == 'install' || $phase == 'runtime') {
22
    if (!drupal_get_path('module', 'libraries')) {
23
      $requirements['views_slideshow_cycle'] = array(
24
        'title' => t('Libraries module missing'),
25
        'severity' => REQUIREMENT_ERROR,
26
        'value' => t('Libraries module required for Views Slideshow Cycle'),
27
        'description' => $t('Views Slideshow Cycle module requires the <a href="@url">Libraries module</a> to be installed.', array('@url' => 'http://drupal.org/project/libraries')),
28
      );
29
    }
30
    else {
31
      if ($phase == 'install') {
32
        $views_slideshow = drupal_get_path('module', 'views_slideshow_cycle');
33
        require_once $views_slideshow . '/views_slideshow_cycle.module';
34
      }
35
      // Libraries module may not be installed,
36
      // even if it is listed as dependency in .info file.
37
      // For example, during installation from an installation profile
38
      // Libraries will *not* be installed when hook_requirements get called.
39
      if (!function_exists('libraries_get_path')) {
40
        include_once drupal_get_path('module', 'libraries') . '/libraries.module';
41
      }
42
      if (!$cycle_path = _views_slideshow_cycle_library_path()) {
43
        $requirements['views_slideshow_jquery_cycle'] = array(
44
          'title' => t('jQuery Cycle Library'),
45
          'severity' => REQUIREMENT_ERROR,
46
          'value' => t('Library required for Views Slideshow Cycle'),
47
          '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.js into it. You can find the plugin at !url.', array(
48
            '!url' => l(t('GitHub'), 'https://raw.githubusercontent.com/malsup/cycle/3.0.3/jquery.cycle.all.js', array('attributes' => array('target' => '_blank'))),
49
          )),
50
        );
51
      }
52
      else {
53
        $requirements['views_slideshow_jquery_cycle'] = array(
54
          'title' => t('jQuery Cycle Library'),
55
          'value' => t('Installed'),
56
          'severity' => REQUIREMENT_OK,
57
        );
58
      }
59
    }
60
  }
61
  return $requirements;
62
}