Projet

Général

Profil

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

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

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('view' => NULL, 'settings' => array(), 'rows' => array(), 'title' => ''),
15
      'template' => 'theme/views-slideshow-cycle',
16
      'file' => 'theme/views_slideshow_cycle.theme.inc',
17
      'pattern' => 'views_slideshow_cycle__',
18
    ),
19
    'views_slideshow_cycle_main_frame' => array(
20
      'variables' => array('vss_id' => NULL, 'view' => NULL, 'settings' => NULL, 'rows' => NULL),
21
      'template' => 'theme/views-slideshow-cycle-main-frame',
22
      'pattern' => 'views_slideshow_cycle_main_frame__',
23
    ),
24
    'views_slideshow_cycle_main_frame_row' => array(
25
      'variables' => array('vss_id' => NULL, 'items' => NULL, 'count' => NULL, 'view' => NULL),
26
      'template' => 'theme/views-slideshow-cycle-main-frame-row',
27
      'pattern' => 'views_slideshow_cycle_main_frame_row__',
28
    ),
29
    'views_slideshow_cycle_main_frame_row_item' => array(
30
      'variables' => array('item' => NULL, 'item_count' => NULL, 'count' => NULL, 'view' => NULL, 'length' => NULL),
31
      'template' => 'theme/views-slideshow-cycle-main-frame-row-item',
32
      'views_slideshow_cycle_main_frame_row_item__',
33
    ),
34
  );
35
}
36

    
37
/**
38
 * Implements hook_help().
39
 */
40
function views_slideshow_cycle_help($path, $arg) {
41
  switch ($path) {
42
    case 'admin/help#views_slideshow_cycle':
43
      if (module_exists('advanced_help')) {
44
        $output = '<p>' . l('Click here to view the documentation for Views Slideshow Cycle.',  'admin/advanced_help/views_slideshow_cycle') . '</p>';
45
      }
46
      else {
47
        $output = '<p>' . t('Views Slideshow Cycle help can be found by installing and enabling the !advanced_help',  array('!advanced_help' => l('Advanced Help module', 'http://drupal.org/project/advanced_help'))) . '</p>';
48
      }
49
      return $output;
50
  }
51
}
52

    
53
/**
54
 * Gets the path to the jQuery cycle library.
55
 *
56
 * @return
57
 *   The path to the cycle library js file, or FALSE if not found.
58
 */
59
function _views_slideshow_cycle_library_path() {
60
  $cycle_path = libraries_get_path('jquery.cycle');
61

    
62
  if (!empty($cycle_path)) {
63
    // Attempt to use minified version of jQuery cycle plugin.
64
    if (file_exists($cycle_path . '/jquery.cycle.all.min.js')) {
65
      $cycle_path .= '/jquery.cycle.all.min.js';
66
    }
67
    // Otherwise use non-minified version if available.
68
    elseif (file_exists($cycle_path . '/jquery.cycle.all.js')) {
69
      $cycle_path .= '/jquery.cycle.all.js';
70
    }
71
    else {
72
      $cycle_path = FALSE;
73
    }
74
  }
75
  else {
76
    $cycle_path = FALSE;
77
  }
78

    
79
  return $cycle_path;
80
}
81

    
82
/**
83
 * Gets the path to the jQuery pause library.
84
 *
85
 * @return
86
 *   The path to the pause library js file, or FALSE if not found.
87
 */
88
function _views_slideshow_cycle_pause_library_path() {
89
  $pause_path = libraries_get_path('jquery.pause');
90

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

    
108
  return $pause_path;
109
}
110

    
111

    
112
/**
113
 * Need to have preprocess functions here because drupal doesn't cache them
114
 * correctly in the theme.inc file.
115
 *
116
 * If you would like to override the preprocess functions make sure to look at
117
 * the associated function in theme.inc.
118
 */
119

    
120
// Trying to make sure the theme.inc get's loaded.
121
include_once('theme/views_slideshow_cycle.theme.inc');
122

    
123
function template_preprocess_views_slideshow_cycle_main_frame(&$vars) {
124
  _views_slideshow_cycle_preprocess_views_slideshow_cycle_main_frame($vars);
125
}
126

    
127
function template_preprocess_views_slideshow_cycle_main_frame_row(&$vars) {
128
  _views_slideshow_cycle_preprocess_views_slideshow_cycle_main_frame_row($vars);
129
}
130

    
131
function template_preprocess_views_slideshow_cycle_main_frame_row_item(&$vars) {
132
  _views_slideshow_cycle_preprocess_views_slideshow_cycle_main_frame_row_item($vars);
133
}