Projet

Général

Profil

Paste
Télécharger (3,76 ko) Statistiques
| Branche: | Révision:

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

1
<?php
2

    
3
/**
4
 * @file
5
 * Views Slideshow: cycle is typically used for field views.
6
 */
7

    
8
/**
9
 * Implements hook_theme().
10
 */
11
function views_slideshow_cycle_theme($existing, $type, $theme, $path) {
12
  return array(
13
    'views_slideshow_cycle' => array(
14
      'variables' => array(
15
        'view' => NULL,
16
        'settings' => array(),
17
        'rows' => array(),
18
        'title' => '',
19
      ),
20
      'template' => 'theme/views-slideshow-cycle',
21
      'file' => 'theme/views_slideshow_cycle.theme.inc',
22
      'pattern' => 'views_slideshow_cycle__',
23
    ),
24
    'views_slideshow_cycle_main_frame' => array(
25
      'variables' => array(
26
        'vss_id' => NULL,
27
        'view' => NULL,
28
        'settings' => NULL,
29
        'rows' => NULL,
30
      ),
31
      'template' => 'theme/views-slideshow-cycle-main-frame',
32
      'file' => 'theme/views_slideshow_cycle.theme.inc',
33
      'pattern' => 'views_slideshow_cycle_main_frame__',
34
    ),
35
    'views_slideshow_cycle_main_frame_row' => array(
36
      'variables' => array(
37
        'vss_id' => NULL,
38
        'items' => NULL,
39
        'count' => NULL,
40
        'view' => NULL,
41
      ),
42
      'template' => 'theme/views-slideshow-cycle-main-frame-row',
43
      'file' => 'theme/views_slideshow_cycle.theme.inc',
44
      'pattern' => 'views_slideshow_cycle_main_frame_row__',
45
    ),
46
    'views_slideshow_cycle_main_frame_row_item' => array(
47
      'variables' => array(
48
        'item' => NULL,
49
        'item_count' => NULL,
50
        'count' => NULL,
51
        'view' => NULL,
52
        'length' => NULL,
53
      ),
54
      'template' => 'theme/views-slideshow-cycle-main-frame-row-item',
55
      'file' => 'theme/views_slideshow_cycle.theme.inc',
56
      'pattern' => 'views_slideshow_cycle_main_frame_row_item__',
57
    ),
58
  );
59
}
60

    
61
/**
62
 * Implements hook_help().
63
 */
64
function views_slideshow_cycle_help($path, $arg) {
65
  switch ($path) {
66
    case 'admin/help#views_slideshow_cycle':
67
      if (module_exists('advanced_help')) {
68
        $output = '<p>' . l(t('Click here to view the documentation for Views Slideshow Cycle.'), 'admin/help/ah/views_slideshow_cycle') . '</p>';
69
      }
70
      else {
71
        $output = '<p>' . t('Views Slideshow Cycle help can be found by installing and enabling the !advanced_help', array(
72
          '!advanced_help' => l(t('Advanced Help module'), 'http://drupal.org/project/advanced_help'))
73
        ) . '</p>';
74
      }
75
      return $output;
76
  }
77
}
78

    
79
/**
80
 * Gets the path to the jQuery cycle library.
81
 *
82
 * @return string
83
 *   The path to the cycle library js file, or FALSE if not found.
84
 */
85
function _views_slideshow_cycle_library_path() {
86
  $cycle_path = libraries_get_path('jquery.cycle');
87

    
88
  if (!empty($cycle_path)) {
89
    // Attempt to use minified version of jQuery cycle plugin.
90
    if (file_exists($cycle_path . '/jquery.cycle.all.min.js')) {
91
      $cycle_path .= '/jquery.cycle.all.min.js';
92
    }
93
    // Otherwise use non-minified version if available.
94
    elseif (file_exists($cycle_path . '/jquery.cycle.all.js')) {
95
      $cycle_path .= '/jquery.cycle.all.js';
96
    }
97
    else {
98
      $cycle_path = FALSE;
99
    }
100
  }
101
  else {
102
    $cycle_path = FALSE;
103
  }
104

    
105
  return $cycle_path;
106
}
107

    
108
/**
109
 * Gets the path to the jQuery pause library.
110
 *
111
 * @return string
112
 *   The path to the pause library js file, or FALSE if not found.
113
 */
114
function _views_slideshow_cycle_pause_library_path() {
115
  $pause_path = libraries_get_path('jquery.pause');
116

    
117
  if (!empty($pause_path)) {
118
    // Attempt to use minified version of jQuery pause plugin.
119
    if (file_exists($pause_path . '/jquery.pause.min.js')) {
120
      $pause_path .= '/jquery.pause.min.js';
121
    }
122
    // Otherwise use non-minified version if available.
123
    elseif (file_exists($pause_path . '/jquery.pause.js')) {
124
      $pause_path .= '/jquery.pause.js';
125
    }
126
    else {
127
      $pause_path = FALSE;
128
    }
129
  }
130
  else {
131
    $pause_path = FALSE;
132
  }
133

    
134
  return $pause_path;
135
}