| 1 |
<?php |
<?php |
| 2 |
// $Id: image_cycle.module,v 1.1 2008/12/29 22:30:24 boombatower Exp $ |
// $Id: image_cycle.module,v 1.1.2.1 2009/05/01 02:47:13 boombatower Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* Create an image slideshow from images in a gallery using the jQuery Cycle plugin. |
* Create an image slideshow from images in a gallery using the jQuery Cycle plugin. |
| 49 |
$form['image_cycle']['effect'] = array( |
$form['image_cycle']['effect'] = array( |
| 50 |
'#type' => 'select', |
'#type' => 'select', |
| 51 |
'#title' => t('Effect'), |
'#title' => t('Effect'), |
| 52 |
|
'#description' => t('Please note that the available effects will depend on which version of the jQuery Cycle Plugin ' . |
| 53 |
|
'is installed.'), |
| 54 |
'#options' => array( |
'#options' => array( |
| 55 |
'blindX', |
'blindX', |
| 56 |
'blindY', |
'blindY', |
| 86 |
$form['image_cycle']['parameters'] = array( |
$form['image_cycle']['parameters'] = array( |
| 87 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 88 |
'#title' => t('Parameters'), |
'#title' => t('Parameters'), |
| 89 |
'#description' => t('Custom parameters to pass with the effect. Place each parameter on a line in the format KEY:VALUE.' . |
'#description' => t('Custom parameters to pass with the effect. Place each parameter on a line in the format KEY:VALUE. ' . |
| 90 |
'Leave blank for default effect settings.'), |
'Leave blank for default effect settings. ' . |
| 91 |
|
'See the <a href="@reference">jQuery Cycle Plugin - Option Reference</a> for a list options and an ' . |
| 92 |
|
'explaination of what they do.', |
| 93 |
|
array('@reference' => 'http://malsup.com/jquery/cycle/options.html')), |
| 94 |
'#default_value' => '', |
'#default_value' => '', |
| 95 |
); |
); |
| 96 |
|
|
| 97 |
|
// Implode paramters. |
| 98 |
$parameters = variable_get('image_cycle_parameters_' . $form['vid']['#value'], array()); |
$parameters = variable_get('image_cycle_parameters_' . $form['vid']['#value'], array()); |
| 99 |
foreach ($parameters as $key => $value) { |
foreach ($parameters as $key => $value) { |
| 100 |
$form['image_cycle']['parameters']['#default_value'] .= "$key: $value\n"; |
$form['image_cycle']['parameters']['#default_value'] .= "$key: $value\n"; |
| 103 |
$form['image_cycle']['css'] = array( |
$form['image_cycle']['css'] = array( |
| 104 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 105 |
'#title' => t('CSS'), |
'#title' => t('CSS'), |
| 106 |
'#description' => t('Custom CSS for the slideshow. The images will be encapsulated by <em>image_cycle_pictures</em>.'), |
'#description' => t('Custom CSS for the slideshow. The images will be encapsulated by <em>div.image_cycle_pictures</em>.'), |
| 107 |
'#default_value' => variable_get('image_cycle_css_' . $form['vid']['#value'], '') |
'#default_value' => variable_get('image_cycle_css_' . $form['vid']['#value'], '') |
| 108 |
); |
); |
| 109 |
} |
} |
| 115 |
function image_cycle_gallery_submit($form_id, &$form_values) { |
function image_cycle_gallery_submit($form_id, &$form_values) { |
| 116 |
variable_set('image_cycle_effect_' . $form_values['vid'], $form_values['image_cycle']['effect']); |
variable_set('image_cycle_effect_' . $form_values['vid'], $form_values['image_cycle']['effect']); |
| 117 |
|
|
| 118 |
|
// Explode parameters by line and key => value pair. |
| 119 |
$parameters_input = explode("\n", $form_values['image_cycle']['parameters']); |
$parameters_input = explode("\n", $form_values['image_cycle']['parameters']); |
| 120 |
$parameters = array(); |
$parameters = array(); |
| 121 |
foreach ($parameters_input as $parameter) { |
foreach ($parameters_input as $parameter) { |