Projet

Général

Profil

Paste
Télécharger (24,1 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views_slideshow / contrib / views_slideshow_cycle / views_slideshow_cycle.views_slideshow.inc @ 7547bb19

1
<?php
2

    
3
/**
4
 * @file
5
 * The default options available with Views Slideshow: cycle.
6
 */
7

    
8
/**
9
 * Implements hook_views_slideshow_slideshow_info().
10
 */
11
function views_slideshow_cycle_views_slideshow_slideshow_info() {
12
  $options = array(
13
    'views_slideshow_cycle' => array(
14
      'name' => t('Cycle'),
15
      'accepts' => array(
16
        'goToSlide',
17
        'nextSlide',
18
        'pause',
19
        'play',
20
        'previousSlide',
21
      ),
22
      'calls' => array(
23
        'transitionBegin',
24
        'transitionEnd',
25
        'goToSlide',
26
        'pause',
27
        'play',
28
        'nextSlide',
29
        'previousSlide',
30
      ),
31
    ),
32
  );
33
  return $options;
34
}
35

    
36
/**
37
 * Implements hook_views_slideshow_option_definition().
38
 */
39
function views_slideshow_cycle_views_slideshow_option_definition() {
40
  $options['views_slideshow_cycle'] = array(
41
    'contains' => array(
42
      // Transition.
43
      'effect' => array('default' => 'fade'),
44
      'transition_advanced' => array('default' => 0),
45
      'timeout' => array('default' => 5000),
46
      'speed' => array('default' => 700),
47
      'delay' => array('default' => 0),
48
      'sync' => array('default' => 1),
49
      'random' => array('default' => 0),
50

    
51
      // Action.
52
      'pause' => array('default' => 1),
53
      'pause_on_click' => array('default' => 0),
54
      'play_on_hover' => array('default' => 0),
55
      'action_advanced' => array('default' => 0),
56
      'start_paused' => array('default' => 0),
57
      'remember_slide' => array('default' => 0),
58
      'remember_slide_days' => array('default' => 1),
59
      'pause_in_middle' => array('default' => 0),
60
      'pause_when_hidden' => array('default' => 0),
61
      'pause_when_hidden_type' => array('default' => 'full'),
62
      'amount_allowed_visible' => array('default' => ''),
63
      'nowrap' => array('default' => 0),
64
      'pause_after_slideshow' => array('default' => 0),
65
      'fixed_height' => array('default' => 1),
66
      'items_per_slide' => array('default' => 1),
67
      'wait_for_image_load' => array('default' => 1),
68
      'wait_for_image_load_timeout' => array('default' => 3000),
69

    
70
      // Internet Explorer Tweaks.
71
      'cleartype' => array('default' => 'true'),
72
      'cleartypenobg' => array('default' => 'false'),
73

    
74
      // Advanced.
75
      'advanced_options' => array('default' => '{}'),
76
    ),
77
  );
78
  return $options;
79
}
80

    
81
/**
82
 * Implements hook_views_slideshow_slideshow_slideshow_type_form().
83
 */
84
function views_slideshow_cycle_views_slideshow_slideshow_type_form(&$form, &$form_state, &$view) {
85
  if (!$cycle_path = _views_slideshow_cycle_library_path()) {
86
    $form['views_slideshow_cycle']['no_cycle_js'] = array(
87
      '#markup' => '<div style="color: red">' . 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(
88
        '!url' => l(t('GitHub'), 'https://raw.githubusercontent.com/malsup/cycle/3.0.3/jquery.cycle.all.js', array(
89
          'attributes' => array('target' => '_blank'),
90
        )),
91
      )) . '</div>',
92
    );
93
  }
94

    
95
  // Transition.
96
  $form['views_slideshow_cycle']['transition'] = array(
97
    '#markup' => '<h2>' . t('Transition') . '</h2>',
98
  );
99

    
100
  $effects = array(
101
    'none' => 'none',
102
    'blindX' => 'blindX',
103
    'blindY' => 'blindY',
104
    'blindZ' => 'blindZ',
105
    'cover' => 'cover',
106
    'curtainX' => 'curtainX',
107
    'curtainY' => 'curtainY',
108
    'fade' => 'fade',
109
    'fadeout' => 'fadeout',
110
    'fadeZoom' => 'fadeZoom',
111
    'growX' => 'growX',
112
    'growY' => 'growY',
113
    'scrollUp' => 'scrollUp',
114
    'scrollDown' => 'scrollDown',
115
    'scrollLeft' => 'scrollLeft',
116
    'scrollRight' => 'scrollRight',
117
    'scrollHorz' => 'scrollHorz',
118
    'scrollVert' => 'scrollVert',
119
    'shuffle' => 'shuffle',
120
    'slideX' => 'slideX',
121
    'slideY' => 'slideY',
122
    'toss' => 'toss',
123
    'turnUp' => 'turnUp',
124
    'turnDown' => 'turnDown',
125
    'turnLeft' => 'turnLeft',
126
    'turnRight' => 'turnRight',
127
    'uncover' => 'uncover',
128
    'wipe' => 'wipe',
129
    'zoom' => 'zoom',
130
  );
131
  $form['views_slideshow_cycle']['effect'] = array(
132
    '#type' => 'select',
133
    '#title' => t('Effect'),
134
    '#options' => $effects,
135
    '#default_value' => $view->options['views_slideshow_cycle']['effect'],
136
    '#description' => t('The transition effect that will be used to change between images. Not all options below may be relevant depending on the effect. !link', array(
137
      '!link' => l(t('Follow this link to see examples of each effect.'), 'http://jquery.malsup.com/cycle/browser.html', array(
138
        'attributes' => array('target' => '_blank'),
139
      )),
140
    )),
141
  );
142

    
143
  // Transition advanced options.
144
  $form['views_slideshow_cycle']['transition_advanced'] = array(
145
    '#type' => 'checkbox',
146
    '#title' => t('View Transition Advanced Options'),
147
    '#default_value' => $view->options['views_slideshow_cycle']['transition_advanced'],
148
  );
149

    
150
  // Need to wrap this so it indents correctly.
151
  $form['views_slideshow_cycle']['transition_advanced_wrapper'] = array(
152
    '#markup' => '<div class="vs-dependent">',
153
  );
154

    
155
  $form['views_slideshow_cycle']['timeout'] = array(
156
    '#type' => 'textfield',
157
    '#title' => t('Timer delay'),
158
    '#default_value' => $view->options['views_slideshow_cycle']['timeout'],
159
    '#description' => t('Amount of time in milliseconds between transitions. Set the value to 0 to not rotate the slideshow automatically.'),
160
    '#states' => array(
161
      'visible' => array(
162
        ':input[name="style_options[views_slideshow_cycle][transition_advanced]"]' => array('checked' => TRUE),
163
      ),
164
    ),
165
  );
166
  $form['views_slideshow_cycle']['speed'] = array(
167
    '#type' => 'textfield',
168
    '#title' => t('Speed'),
169
    '#default_value' => $view->options['views_slideshow_cycle']['speed'],
170
    '#description' => t('Time in milliseconds that each transition lasts. Numeric only!'),
171
    '#states' => array(
172
      'visible' => array(
173
        ':input[name="style_options[views_slideshow_cycle][transition_advanced]"]' => array('checked' => TRUE),
174
      ),
175
    ),
176
  );
177
  $form['views_slideshow_cycle']['delay'] = array(
178
    '#type' => 'textfield',
179
    '#title' => t('Initial slide delay offset'),
180
    '#default_value' => $view->options['views_slideshow_cycle']['delay'],
181
    '#description' => t('Amount of time in milliseconds for the first slide to transition. This number will be added to Timer delay to create the initial delay.  For example if Timer delay is 4000 and Initial delay is 2000 then the first slide will change at 6000ms (6 seconds).  If Initial delay is -2000 then the first slide will change at 2000ms (2 seconds).'),
182
    '#states' => array(
183
      'visible' => array(
184
        ':input[name="style_options[views_slideshow_cycle][transition_advanced]"]' => array('checked' => TRUE),
185
      ),
186
    ),
187
  );
188
  $form['views_slideshow_cycle']['sync'] = array(
189
    '#type' => 'checkbox',
190
    '#title' => t('Sync'),
191
    '#default_value' => $view->options['views_slideshow_cycle']['sync'],
192
    '#description' => t('The sync option controls whether the slide transitions occur simultaneously. The default is selected which means that the current slide transitions out as the next slide transitions in. By unselecting this option you can get some interesting twists on your transitions.'),
193
    '#states' => array(
194
      'visible' => array(
195
        ':input[name="style_options[views_slideshow_cycle][transition_advanced]"]' => array('checked' => TRUE),
196
      ),
197
    ),
198
  );
199
  $form['views_slideshow_cycle']['random'] = array(
200
    '#type' => 'checkbox',
201
    '#title' => t('Random'),
202
    '#description' => t('This option controls the order items are displayed. The default setting, unselected, uses the views ordering. Selected will cause the images to display in a random order.'),
203
    '#default_value' => $view->options['views_slideshow_cycle']['random'],
204
    '#states' => array(
205
      'visible' => array(
206
        ':input[name="style_options[views_slideshow_cycle][transition_advanced]"]' => array('checked' => TRUE),
207
      ),
208
    ),
209
  );
210

    
211
  $form['views_slideshow_cycle']['transition_advanced_wrapper_close'] = array(
212
    '#markup' => '</div>',
213
  );
214

    
215
  // Action.
216
  $form['views_slideshow_cycle']['action'] = array(
217
    '#markup' => '<h2>' . t('Action') . '</h2>',
218
  );
219
  $form['views_slideshow_cycle']['pause'] = array(
220
    '#type' => 'checkbox',
221
    '#title' => t('Pause on hover'),
222
    '#default_value' => $view->options['views_slideshow_cycle']['pause'],
223
    '#description' => t('Pause when hovering on the slideshow image.'),
224
    '#states' => array(
225
      'enabled' => array(
226
        ':input[name="style_options[views_slideshow_cycle][play_on_hover]"]' => array('checked' => FALSE),
227
      ),
228
    ),
229
  );
230
  $form['views_slideshow_cycle']['play_on_hover'] = array(
231
    '#type' => 'checkbox',
232
    '#title' => t('Play on hover'),
233
    '#default_value' => $view->options['views_slideshow_cycle']['play_on_hover'],
234
    '#description' => t('Play when hovering on the slideshow image.'),
235
    '#states' => array(
236
      'enabled' => array(
237
        ':input[name="style_options[views_slideshow_cycle][pause]"]' => array('checked' => FALSE),
238
      ),
239
    ),
240
  );
241
  $form['views_slideshow_cycle']['pause_on_click'] = array(
242
    '#type' => 'checkbox',
243
    '#title' => t('Pause On Click'),
244
    '#default_value' => $view->options['views_slideshow_cycle']['pause_on_click'],
245
    '#description' => t('Pause when the slide is clicked.'),
246
  );
247

    
248
  // Action Advanced Options.
249
  $form['views_slideshow_cycle']['action_advanced'] = array(
250
    '#type' => 'checkbox',
251
    '#title' => t('View Action Advanced Options'),
252
    '#default_value' => $view->options['views_slideshow_cycle']['action_advanced'],
253
  );
254

    
255
  // Need to wrap this so it indents correctly.
256
  $form['views_slideshow_cycle']['action_advanced_wrapper'] = array(
257
    '#markup' => '<div class="vs-dependent">',
258
  );
259

    
260
  $form['views_slideshow_cycle']['start_paused'] = array(
261
    '#type' => 'checkbox',
262
    '#title' => t('Start Slideshow Paused'),
263
    '#default_value' => $view->options['views_slideshow_cycle']['start_paused'],
264
    '#description' => t('Start the slideshow in the paused state.'),
265
    '#states' => array(
266
      'visible' => array(
267
        ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE),
268
      ),
269
    ),
270
  );
271
  $form['views_slideshow_cycle']['remember_slide'] = array(
272
    '#type' => 'checkbox',
273
    '#title' => t('Start On Last Slide Viewed'),
274
    '#default_value' => $view->options['views_slideshow_cycle']['remember_slide'],
275
    '#description' => t('When the user leaves a page with a slideshow and comes back start them on the last slide viewed.'),
276
    '#states' => array(
277
      'visible' => array(
278
        ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE),
279
      ),
280
    ),
281
  );
282
  $form['views_slideshow_cycle']['remember_slide_days'] = array(
283
    '#type' => 'textfield',
284
    '#title' => t('Length of Time to Remember Last Slide'),
285
    '#default_value' => $view->options['views_slideshow_cycle']['remember_slide_days'],
286
    '#description' => t('The number of days to have the site remember the last slide. Default is 1'),
287
    '#prefix' => '<div class="vs-dependent">',
288
    '#suffix' => '</div>',
289
    '#size' => 4,
290
    '#states' => array(
291
      'visible' => array(
292
        ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE),
293
        ':input[name="style_options[views_slideshow_cycle][remember_slide]"]' => array('checked' => TRUE),
294
      ),
295
    ),
296
  );
297

    
298
  if (!$pause_path = _views_slideshow_cycle_pause_library_path()) {
299
    $form['views_slideshow_cycle']['pause_in_middle'] = array(
300
      '#type' => 'checkbox',
301
      '#title' => t('Pause The Slideshow In The Middle of the Transition'),
302
      '#default_value' => $view->options['views_slideshow_cycle']['pause_in_middle'],
303
      '#description' => t('When pausing the slideshow allow it to pause in the middle of tranistioning and not finish the transition until unpaused.'),
304
      '#states' => array(
305
        'visible' => array(
306
          ':input[name="style_options[views_slideshow_cycle][transition_advanced]"]' => array('checked' => TRUE),
307
        ),
308
      ),
309
    );
310
  }
311

    
312
  $form['views_slideshow_cycle']['pause_when_hidden'] = array(
313
    '#type' => 'checkbox',
314
    '#title' => t('Pause When the Slideshow is Not Visible'),
315
    '#default_value' => $view->options['views_slideshow_cycle']['pause_when_hidden'],
316
    '#description' => t('When the slideshow is scrolled out of view or when a window is resized that hides the slideshow, this will pause the slideshow.'),
317
    '#states' => array(
318
      'visible' => array(
319
        ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE),
320
      ),
321
    ),
322
  );
323
  $form['views_slideshow_cycle']['pause_when_hidden_type'] = array(
324
    '#type' => 'select',
325
    '#title' => t('How to Calculate Amount of Slide that Needs to be Shown'),
326
    '#options' => array(
327
      'full' => t('Entire slide'),
328
      'vertical' => t('Set amount of vertical'),
329
      'horizontal' => t('Set amount of horizontal'),
330
      'area' => t('Set total area of the slide'),
331
    ),
332
    '#default_value' => $view->options['views_slideshow_cycle']['pause_when_hidden_type'],
333
    '#description' => t('Choose how to calculate how much of the slide has to be shown. Entire Slide: All the slide has to be shown. Vertical: Set amount of height that has to be shown. Horizontal: Set amount of width that has to be shown. Area: Set total area that has to be shown.'),
334
    '#prefix' => '<div class="vs-dependent">',
335
    '#suffix' => '</div>',
336
    '#states' => array(
337
      'visible' => array(
338
        ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE),
339
        ':input[name="style_options[views_slideshow_cycle][pause_when_hidden]"]' => array('checked' => TRUE),
340
      ),
341
    ),
342
  );
343
  $form['views_slideshow_cycle']['amount_allowed_visible'] = array(
344
    '#type' => 'textfield',
345
    '#title' => t('Amount of Slide Needed to be Shown'),
346
    '#default_value' => $view->options['views_slideshow_cycle']['amount_allowed_visible'],
347
    '#description' => t("The amount of the slide that needs to be shown to have it rotate. You can set the value in percentage (ex: 50%) or in pixels (ex: 250). The slidehsow will not rotate until it's height/width/total area, depending on the calculation method you have chosen above, is less than the value you have entered in this field."),
348
    '#size' => 4,
349
    '#process' => array('views_slideshow_cycle_form_options_js'),
350
  );
351
  $form['views_slideshow_cycle']['nowrap'] = array(
352
    '#type' => 'checkbox',
353
    '#title' => t('End slideshow after last slide'),
354
    '#default_value' => $view->options['views_slideshow_cycle']['nowrap'],
355
    '#description' => t('If selected the slideshow will end when it gets to the last slide.'),
356
    '#states' => array(
357
      'visible' => array(
358
        ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE),
359
      ),
360
    ),
361
  );
362
  $form['views_slideshow_cycle']['pause_after_slideshow'] = array(
363
    '#type' => 'checkbox',
364
    '#title' => t('Pause slideshow and return to first slide after running one slideshow'),
365
    '#default_value' => $view->options['views_slideshow_cycle']['pause_after_slideshow'],
366
    '#description' => t('If selected the slideshow will pause and return to first slide after completeing one slideshow. This option will not work if you are using it with End slideshow after last slide option'),
367
    '#states' => array(
368
      'visible' => array(
369
        ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE),
370
      ),
371
    ),
372
  );
373
  $form['views_slideshow_cycle']['fixed_height'] = array(
374
    '#type' => 'checkbox',
375
    '#title' => t('Make the slide window height fit the largest slide'),
376
    '#default_value' => $view->options['views_slideshow_cycle']['fixed_height'],
377
    '#description' => t('If unselected then if the slides are different sizes the height of the slide area will change as the slides change.'),
378
    '#states' => array(
379
      'visible' => array(
380
        ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE),
381
      ),
382
    ),
383
  );
384
  $form['views_slideshow_cycle']['items_per_slide'] = array(
385
    '#type' => 'textfield',
386
    '#title' => t('Items per slide'),
387
    '#default_value' => $view->options['views_slideshow_cycle']['items_per_slide'],
388
    '#description' => t('The number of items per slide'),
389
    '#size' => 4,
390
    '#states' => array(
391
      'visible' => array(
392
        ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE),
393
      ),
394
    ),
395
  );
396
  $form['views_slideshow_cycle']['wait_for_image_load'] = array(
397
    '#type' => 'checkbox',
398
    '#title' => t('Wait for all the slide images to load'),
399
    '#default_value' => $view->options['views_slideshow_cycle']['wait_for_image_load'],
400
    '#description' => t('If selected the slideshow will not start unless all the slide images are loaded.  This will fix some issues on IE7/IE8/Chrome/Opera.'),
401
    '#states' => array(
402
      'visible' => array(
403
        ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE),
404
      ),
405
    ),
406
  );
407
  $form['views_slideshow_cycle']['wait_for_image_load_timeout'] = array(
408
    '#type' => 'textfield',
409
    '#title' => t('Timeout'),
410
    '#default_value' => $view->options['views_slideshow_cycle']['wait_for_image_load_timeout'],
411
    '#description' => t('How long should it wait until it starts the slideshow anyway. Time is in milliseconds.'),
412
    '#prefix' => '<div class="vs-dependent">',
413
    '#suffix' => '</div>',
414
    '#states' => array(
415
      'visible' => array(
416
        ':input[name="style_options[views_slideshow_cycle][action_advanced]"]' => array('checked' => TRUE),
417
        ':input[name="style_options[views_slideshow_cycle][wait_for_image_load]"]' => array('checked' => TRUE),
418
      ),
419
    ),
420
  );
421

    
422
  // Need to wrap this so it indents correctly.
423
  $form['views_slideshow_cycle']['action_advanced_wrapper_close'] = array(
424
    '#markup' => '</div>',
425
  );
426

    
427
  // Internet Explorer Tweaks.
428
  $form['views_slideshow_cycle']['ie_tweaks'] = array(
429
    '#markup' => '<h2>' . t('Internet Explorer Tweaks') . '</h2>',
430
  );
431
  $form['views_slideshow_cycle']['cleartype'] = array(
432
    '#type' => 'checkbox',
433
    '#title' => t('ClearType'),
434
    '#default_value' => $view->options['views_slideshow_cycle']['cleartype'],
435
    '#description' => t('Select if clearType corrections should be applied (for IE).  Some background issues could be fixed by unselecting this option.'),
436
  );
437
  $form['views_slideshow_cycle']['cleartypenobg'] = array(
438
    '#type' => 'checkbox',
439
    '#title' => t('ClearType Background'),
440
    '#default_value' => $view->options['views_slideshow_cycle']['cleartypenobg'],
441
    '#description' => t('Select to disable extra cleartype fixing.  Unselect to force background color setting on slides)'),
442
  );
443

    
444
  // Advanced Options.
445
  $form['views_slideshow_cycle']['advanced_options_header'] = array(
446
    '#markup' => '<h2>' . t('jQuery Cycle Custom Options') . '</h2>',
447
  );
448

    
449
  $json2_path = libraries_get_path('json2');
450
  if (empty($json2_path) || !file_exists($json2_path . '/json2.js')) {
451
    $form['views_slideshow_cycle']['no_json_js'] = array(
452
      '#markup' => '<div>' . t('To use the advanced options you need to download json2.js. You can do this by clicking the download button at !url and extract json2.js to sites/all/libraries/json2', array(
453
        '!url' => l(t('the Github repository'), 'https://github.com/douglascrockford/JSON-js', array(
454
          'attributes' => array('target' => '_blank'),
455
        )),
456
      )) . '</div>',
457
    );
458
  }
459
  else {
460
    $form['views_slideshow_cycle']['advanced_options_info'] = array(
461
      '#markup' => '<p>' . t('You can find a list of all the available options at !documentation.  If one of the options you add uses a function, example fxFn, then you need to only enter what goes inside the function call. The variables that are in the !documentation on the jquery cycle site will be available to you.', array(
462
        '!documentation' => l(t('documentation'), 'http://malsup.com/jquery/cycle/options.html'),
463
      )) . '</p>',
464
    );
465

    
466
    // All the jquery cycle options according to
467
    // http://malsup.com/jquery/cycle/options.html
468
    $cycle_options = array(
469
      0 => 'Select One',
470
      'activePagerClass' => 'activePagerClass',
471
      'after' => 'after',
472
      'allowPagerClickBubble' => 'allowPagerClickBubble',
473
      'animIn' => 'animIn',
474
      'animInDelay' => 'animInDelay',
475
      'animOut' => 'animOut',
476
      'animOutDelay' => 'animOutDelay',
477
      'autostop' => 'autostop',
478
      'autostopCount' => 'autostopCount',
479
      'backwards' => 'backwards',
480
      'before' => 'before',
481
      'bounce' => 'bounce',
482
      'cleartype' => 'cleartype',
483
      'cleartypeNoBg' => 'cleartypeNoBg',
484
      'containerResize' => 'containerResize',
485
      'continuous' => 'continuous',
486
      'cssAfter' => 'cssAfter',
487
      'cssBefore' => 'cssBefore',
488
      'delay' => 'delay',
489
      'easeIn' => 'easeIn',
490
      'easeOut' => 'easeOut',
491
      'easing' => 'easing',
492
      'end' => 'end',
493
      'fastOnEvent' => 'fastOnEvent',
494
      'fit' => 'fit',
495
      'fx' => 'fx',
496
      'fxFn' => 'fxFn',
497
      'height' => 'height',
498
      'manualTrump' => 'manualTrump',
499
      'metaAttr' => 'metaAttr',
500
      'next' => 'next',
501
      'nowrap' => 'nowrap',
502
      'onPagerEvent' => 'onPagerEvent',
503
      'onPrevNextEvent' => 'onPrevNextEvent',
504
      'pager' => 'pager',
505
      'pagerAnchorBuilder' => 'pagerAnchorBuilder',
506
      'pagerEvent' => 'pagerEvent',
507
      'pause' => 'pause',
508
      'paused' => 'paused',
509
      'pauseOnPagerHover' => 'pauseOnPagerHover',
510
      'prev' => 'prev',
511
      'prevNextEvent' => 'prevNextEvent',
512
      'random' => 'random',
513
      'randomizeEffects' => 'randomizeEffects',
514
      'requeueOnImageNotLoaded' => 'requeueOnImageNotLoaded',
515
      'requeueTimeout' => 'requeueTimeout',
516
      'resumed' => 'resumed',
517
      'rev' => 'rev',
518
      'shuffle' => 'shuffle',
519
      'slideExpr' => 'slideExpr',
520
      'slideResize' => 'slideResize',
521
      'speed' => 'speed',
522
      'speedIn' => 'speedIn',
523
      'speedOut' => 'speedOut',
524
      'startingSlide' => 'startingSlide',
525
      'sync' => 'sync',
526
      'timeout' => 'timeout',
527
      'timeoutFn' => 'timeoutFn',
528
      'updateActivePagerLink' => 'updateActivePagerLink',
529
      'width' => 'width',
530
    );
531

    
532
    $form['views_slideshow_cycle']['advanced_options_choices'] = array(
533
      '#type' => 'select',
534
      '#title' => t('Advanced Options'),
535
      '#options' => $cycle_options,
536
      '#process' => array('views_slideshow_cycle_form_options_js'),
537
    );
538

    
539
    $form['views_slideshow_cycle']['advanced_options_entry'] = array(
540
      '#type' => 'textarea',
541
      '#title' => t('Advanced Option Value'),
542
      '#description' => t('It is important that you click the Update link when you make any changes to the options or those changes will not be saved when you save the form.'),
543
    );
544

    
545
    $form['views_slideshow_cycle']['advanced_options'] = array(
546
      '#type' => 'textarea',
547
      '#default_value' => $view->options['views_slideshow_cycle']['advanced_options'],
548
    );
549

    
550
    $form['views_slideshow_cycle']['advanced_options_table'] = array(
551
      '#markup' => '<table style="width: 400px; margin-left: 10px;" id="edit-style-options-views-slideshow-cycle-advanced-options-table"></table>',
552
    );
553
  }
554
}
555

    
556
/**
557
 * Add the form options JS to the Views Slideshow Cycle admin form.
558
 */
559
function views_slideshow_cycle_form_options_js($element, &$form_state, &$form) {
560
  ctools_add_js('formoptions', 'views_slideshow_cycle');
561
  return $element;
562
}
563

    
564
/**
565
 * Implements hook_views_slideshow_options_form_validate().
566
 */
567
function views_slideshow_cycle_views_slideshow_options_form_validate(&$form, &$form_state, &$view) {
568
  if (!is_numeric($form_state['values']['style_options']['views_slideshow_cycle']['speed'])) {
569
    form_error($form['views_slideshow_cycle']['speed'], t('!setting must be numeric!', array('!setting' => 'Speed')));
570
  }
571
  if (!is_numeric($form_state['values']['style_options']['views_slideshow_cycle']['timeout'])) {
572
    form_error($form['views_slideshow_cycle']['timeout'], t('!setting must be numeric!', array('!setting' => 'Timeout')));
573
  }
574
  if (!is_numeric($form_state['values']['style_options']['views_slideshow_cycle']['remember_slide_days'])) {
575
    form_error($form['views_slideshow_cycle']['remember_slide_days'], t('!setting must be numeric!', array('!setting' => 'Slide days')));
576
  }
577
}