function fancybox_options in fancyBox 6
Same name and namespace in other branches
- 7 fancybox.module \fancybox_options()
Define form elements for the Fancybox plugin's options.
1 call to fancybox_options()
- fancybox_admin_settings_form in ./
fancybox.admin.inc - Display the Fancybox settings form.
File
- ./
fancybox.module, line 164 - Provides the Fancybox jQuery plugin for displaying images, HTML content and multimedia in an elegant box.
Code
function fancybox_options($values = array()) {
/*
Fancybox 1.3.1 options:
TODO: autoDimensions true For inline and ajax views, resizes the view to the element recieves. Make sure it has dimensions otherwise this will give unexpected results
TODO: modal false When true, 'overlayShow' is set to 'true' and 'hideOnOverlayClick', 'hideOnContentClick', 'enableEscapeButton', 'showCloseButton' are set to 'false'
TODO: ajax { } Ajax options (error, success will be overwritten)
TODO: swf {wmode: 'transparent'} Flashvars to put on the swf object
TODO: titleFormat null Callback to customize title area. You can set any html - custom image counter or even custom navigation
*/
$easing_options = array(
'none' => t('None'),
'swing' => t('Swing'),
'easeInQuad' => t('Quad in'),
'easeOutQuad' => t('Quad out'),
'easeInOutQuad' => t('Quad in/out'),
'easeInCubic' => t('Cubic in'),
'easeOutCubic' => t('Cubic out'),
'easeInOutCubic' => t('Cubic in/out'),
'easeInQuart' => t('Quart in'),
'easeOutQuart' => t('Quart out'),
'easeInOutQuart' => t('Quart in/out'),
'easeInQuint' => t('Quint in'),
'easeOutQuint' => t('Quint out'),
'easeInOutQuint' => t('Quint in/out'),
'easeInSine' => t('Sine in'),
'easeOutSine' => t('Sine out'),
'easeInOutSine' => t('Sine in/out'),
'easeInExpo' => t('Expo in'),
'easeOutExpo' => t('Expo out'),
'easeInOutExpo' => t('Expo in/out'),
'easeInCirc' => t('Circular in'),
'easeOutCirc' => t('Circular out'),
'easeInOutCirc' => t('Circular in/out'),
'easeInElastic' => t('Elastic in'),
'easeOutElastic' => t('Elastic out'),
'easeInOutElastic' => t('Elastic in/out'),
'easeInBack' => t('Back in'),
'easeOutBack' => t('Back out'),
'easeInOutBack' => t('Back in/out'),
'easeInBounce' => t('Bounce in'),
'easeOutBounce' => t('Bounce out'),
'easeInOutBounce' => t('Bounce in/out'),
);
for ($i = 0; $i <= 10; $i++) {
$float = (double) $i / 10;
$opacity_options[(string) $float] = $i * 10 . '%';
}
$options = array();
$options['appearance'] = array(
'#type' => 'fieldset',
'#title' => t('Appearance'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$options['appearance']['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#description' => t("Width for content types 'iframe' and 'swf'. Also set for inline content if 'autoDimensions' is set to 'false'"),
'#default_value' => isset($values['width']) ? $values['width'] : 425,
'#size' => 5,
);
$options['appearance']['height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#description' => t("Height for content types 'iframe' and 'swf'. Also set for inline content if 'autoDimensions' is set to 'false'"),
'#default_value' => isset($values['height']) ? $values['height'] : 355,
'#size' => 5,
);
$options['appearance']['padding'] = array(
'#type' => 'textfield',
'#title' => t('Padding'),
'#description' => t('Space between FancyBox wrapper and content'),
'#default_value' => isset($values['padding']) ? $values['padding'] : 10,
'#size' => 5,
);
$options['appearance']['margin'] = array(
'#type' => 'textfield',
'#title' => t('Margin'),
'#description' => t('Space between viewport and FancyBox wrapper'),
'#default_value' => isset($values['margin']) ? $values['margin'] : 20,
'#size' => 5,
);
$options['appearance']['titleShow'] = array(
'#type' => 'checkbox',
'#title' => t('Show title'),
'#description' => t('If checked, shows the title.'),
'#default_value' => isset($values['titleShow']) ? $values['titleShow'] : TRUE,
);
$options['appearance']['titlePosition'] = array(
'#type' => 'select',
'#title' => t('Title position'),
'#description' => t('The position of title.'),
'#options' => array(
'outside' => t('Outside'),
'inside' => t('Inside'),
'over' => t('Over'),
),
'#default_value' => isset($values['titlePosition']) ? $values['titlePosition'] : 'outside',
);
$options['appearance']['scrolling'] = array(
'#type' => 'select',
'#title' => t('Content scrolling'),
'#description' => t('Set the overflow CSS property to create or hide scrollbars'),
'#options' => array(
'auto' => t('Auto'),
'yes' => t('Yes'),
'no' => t('No'),
),
'#default_value' => isset($values['scrolling']) ? $values['scrolling'] : 'auto',
);
$options['appearance']['showCloseButton'] = array(
'#type' => 'checkbox',
'#title' => t('Show close button'),
'#description' => t('Toggle close button'),
'#default_value' => isset($values['showCloseButton']) ? $values['showCloseButton'] : TRUE,
);
$options['appearance']['showNavArrows'] = array(
'#type' => 'checkbox',
'#title' => t('Show navigation arrows'),
'#description' => t('Toggle navigation arrows'),
'#default_value' => isset($values['showNavArrows']) ? $values['showNavArrows'] : TRUE,
);
$options['appearance']['cyclic'] = array(
'#type' => 'checkbox',
'#title' => t('Cyclic'),
'#description' => t('When checked, galleries will be cyclic, allowing you to keep pressing next/back'),
'#default_value' => isset($values['cyclic']) ? $values['cyclic'] : FALSE,
);
$options['appearance']['opacity'] = array(
'#type' => 'checkbox',
'#title' => t('Opacity'),
'#description' => t('If checked, transparency of content is changed for elastic transitions'),
'#default_value' => isset($values['opacity']) ? $values['opacity'] : FALSE,
);
$options['appearance']['overlayShow'] = array(
'#type' => 'checkbox',
'#title' => t('Show overlay'),
'#description' => t('If checked, shows the overlay behind the item'),
'#default_value' => isset($values['overlayShow']) ? $values['overlayShow'] : TRUE,
);
$options['appearance']['overlayColor'] = array(
'#type' => 'textfield',
'#title' => t('Overlay color'),
'#description' => t('Color of the overlay (i.e. #666666)'),
'#default_value' => isset($values['overlayColor']) ? $values['overlayColor'] : '#666',
'#size' => 8,
);
$options['appearance']['overlayOpacity'] = array(
'#type' => 'select',
'#title' => t('Overlay opacity'),
'#description' => t('Opacity of overlay (from 0% to 100%)'),
'#options' => $opacity_options,
'#default_value' => isset($values['overlayOpacity']) ? $values['overlayOpacity'] : 0.3,
);
$options['appearance']['hideOnOverlayClick'] = array(
'#type' => 'checkbox',
'#title' => t('Close on overlay click'),
'#description' => t('If checked, clicking the overlay closes FancyBox'),
'#default_value' => isset($values['hideOnOverlayClick']) ? $values['hideOnOverlayClick'] : FALSE,
);
$options['appearance']['hideOnContentClick'] = array(
'#type' => 'checkbox',
'#title' => t('Close on content click'),
'#description' => t('If checked, clicking the content closes FancyBox'),
'#default_value' => isset($values['hideOnContentClick']) ? $values['hideOnContentClick'] : TRUE,
);
$options['appearance']['enableEscapeButton'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Escape button'),
'#description' => t('If checked, pressing Esc button closes FancyBox'),
'#default_value' => isset($values['enableEscapeButton']) ? $values['enableEscapeButton'] : TRUE,
);
$options['appearance']['centerOnScroll'] = array(
'#type' => 'checkbox',
'#title' => t('Keep centered when scrolling'),
'#description' => t('If checked, item stays centered when user scrolls the page'),
'#default_value' => isset($values['centerOnScroll']) ? $values['centerOnScroll'] : TRUE,
);
$options['appearance']['autoScale'] = array(
'#type' => 'checkbox',
'#title' => t('Scale images'),
'#description' => t('If checked, FancyBox is scaled to fit in viewport'),
'#default_value' => isset($values['autoScale']) ? $values['autoScale'] : TRUE,
);
$options['effects'] = array(
'#type' => 'fieldset',
'#title' => t('Effects'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$options['effects']['easingIn'] = array(
'#type' => 'select',
'#title' => t('Easing effect on open'),
'#description' => t('Easing effect used when opening an item.'),
'#options' => $easing_options,
'#default_value' => isset($values['easingIn']) ? $values['easingIn'] : 'swing',
);
$options['effects']['easingOut'] = array(
'#type' => 'select',
'#title' => t('Easing effect on close'),
'#description' => t('Easing effect used when closing an item.'),
'#options' => $easing_options,
'#default_value' => isset($values['easingOut']) ? $values['easingOut'] : 'swing',
);
$options['effects']['changeFade'] = array(
'#type' => 'select',
'#title' => t('Change fade'),
'#description' => t('Speed of the content fading while changing gallery items'),
'#options' => array(
'fast' => t('Fast'),
),
'#default_value' => isset($values['changeFade']) ? $values['changeFade'] : 'fast',
);
$options['effects']['changeSpeed'] = array(
'#type' => 'textfield',
'#title' => t('Change speed'),
'#description' => t('Speed of resizing when changing gallery items, in milliseconds'),
'#default_value' => isset($values['changeSpeed']) ? $values['changeSpeed'] : 300,
'#size' => 8,
);
$options['effects']['transitionIn'] = array(
'#type' => 'select',
'#title' => t('Transition in'),
'#description' => t('The transition type'),
'#options' => array(
'elastic' => t('Elastic'),
'fade' => t('Fade'),
'none' => t('None'),
),
'#default_value' => isset($values['transitionIn']) ? $values['transitionIn'] : 'fade',
);
$options['effects']['speedIn'] = array(
'#type' => 'textfield',
'#title' => t('Transition in speed'),
'#description' => t('Speed of the fade and elastic transitions, in milliseconds'),
'#default_value' => isset($values['speedIn']) ? $values['speedIn'] : 300,
'#size' => 8,
);
$options['effects']['transitionOut'] = array(
'#type' => 'select',
'#title' => t('Transition out'),
'#description' => t('The transition type'),
'#options' => array(
'elastic' => t('Elastic'),
'fade' => t('Fade'),
'none' => t('None'),
),
'#default_value' => isset($values['transitionOut']) ? $values['transitionOut'] : 'fade',
);
$options['effects']['speedOut'] = array(
'#type' => 'textfield',
'#title' => t('Transition out speed'),
'#description' => t('Speed of the fade and elastic transitions, in milliseconds'),
'#default_value' => isset($values['speedOut']) ? $values['speedOut'] : 300,
'#size' => 8,
);
$options['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$options['advanced']['onStart'] = array(
'#type' => 'textfield',
'#title' => t('Callback on start'),
'#description' => t('Enter the name of a JavaScript function to be called right before attempting to load the content.'),
'#default_value' => isset($values['onStart']) ? $values['onStart'] : '',
);
$options['advanced']['onComplete'] = array(
'#type' => 'textfield',
'#title' => t('Callback on open'),
'#description' => t('Enter the name of a JavaScript function to be called once the content is displayed.'),
'#default_value' => isset($values['onComplete']) ? $values['onComplete'] : '',
);
$options['advanced']['onClosed'] = array(
'#type' => 'textfield',
'#title' => t('Callback on close'),
'#description' => t('Enter the name of a JavaScript function to be called once FancyBox is closed.'),
'#default_value' => isset($values['onClosed']) ? $values['onClosed'] : '',
);
$options['advanced']['onCleanup'] = array(
'#type' => 'textfield',
'#title' => t('Callback on cleanup'),
'#description' => t('Enter the name of a JavaScript function to be called just before closing.'),
'#default_value' => isset($values['onCleanup']) ? $values['onCleanup'] : '',
);
$options['advanced']['onCancel'] = array(
'#type' => 'textfield',
'#title' => t('Callback on cancel'),
'#description' => t('Enter the name of a JavaScript function to be called after loading is canceled.'),
'#default_value' => isset($values['onCancel']) ? $values['onCancel'] : '',
);
return $options;
}