t('None'), 'swing' => t('Swing'), 'easeInQuad' => t('In Quad'), 'easeOutQuad' => t('Out Quad'), 'easeInOutQuad' => t('In Out Quad'), 'easeInCubic' => t('In Cubic'), 'easeOutCubic' => t('Out Cubic'), 'easeInOutCubic' => t('In Out Cubic'), 'easeInQuart' => t('In Quart'), 'easeOutQuart' => t('Out Quart'), 'easeInOutQuart' => t('In Out Quart'), 'easeInQuint' => t('In Quint'), 'easeOutQuint' => t('Out Quint'), 'easeInOutQuint' => t('In Out Quint'), 'easeInSine' => t('In Sine'), 'easeOutSine' => t('Out Sine'), 'easeInOutSine' => t('In Out Sine'), 'easeInExpo' => t('In Expo'), 'easeOutExpo' => t('Out Expo'), 'easeInOutExpo' => t('In Out Expo'), 'easeInCirc' => t('In Circ'), 'easeOutCirc' => t('Out Circ'), 'easeInOutCirc' => t('In Out Circ'), 'easeInElastic' => t('In Elastic'), 'easeOutElastic' => t('Out Elastic'), 'easeInOutElastic' => t('In Out Elastic'), 'easeInBack' => t('In Back'), 'easeOutBack' => t('Out Back'), 'easeInOutBack' => t('In Out Back'), 'easeInBounce' => t('In Bounce'), 'easeOutBounce' => t('Out Bounce'), 'easeInOutBounce' => t('In Out Bounce'), ); for ($i = 0; $i < 10; $i++) { $opacity_options["0.$i"] = "0.$i"; } $opacity_options["1.0"] = "1.0"; $form['fancybox']['fancybox_class_id'] = array( '#type' => 'textfield', '#title' => t('CSS class or id'), '#description' => t('The CSS class or ID to consider for fancybox. Fancybox will insert this value after the tag a.
Example: insert .myimageclass and fancybox will output a.image. Your markup has to be like this: <a class="myimageclass"...><img ... >.'), '#default_value' => variable_get('fancybox_class_id', ''), ); $form['fancybox']['fancybox_padding'] = array( '#type' => 'textfield', '#size' => 4, '#maxlength' => 4, '#title' => t('Fancybox padding'), '#description' => t('Padding around content'), '#default_value' => variable_get('fancybox_padding', 0), ); $form['fancybox']['fancybox_image_scale'] = array( '#type' => 'checkbox', '#title' => t('Fancybox image scale'), '#description' => t('Enable to scale images to fit in viewport'), '#default_value' => variable_get('fancybox_image_scale', TRUE), ); $form['fancybox']['fancybox_zoom_opacity'] = array( '#type' => 'checkbox', '#title' => t('Fancybox zoom opacity'), '#description' => t('Enable to change content transparency when animating'), '#default_value' => variable_get('fancybox_zoom_opacity', TRUE), ); $form['fancybox']['fancybox_zoom_speed_in'] = array( '#type' => 'textfield', '#title' => t('Fancybox zoom speed in'), '#size' => 5, '#maxlength' => 5, '#description' => t('The duration (in seconds) of the zooming-in animation. Enter a value between 0 and 10.'), '#default_value' => variable_get('fancybox_zoom_speed_in', 0.3), ); $form['fancybox']['fancybox_zoom_speed_out'] = array( '#type' => 'textfield', '#title' => t('Fancybox zoom speed out'), '#size' => 5, '#maxlength' => 5, '#description' => t('The duration (in seconds) of the zooming-out animation. Enter a value between 0 and 10.'), '#default_value' => variable_get('fancybox_zoom_speed_out', 0.3), ); $form['fancybox']['fancybox_zoom_speed_change'] = array( '#type' => 'textfield', '#title' => t('Fancybox zoom speed change'), '#size' => 5, '#maxlength' => 5, '#description' => t('The duration (in seconds) of the animation when changing gallery items. Enter a value between 0 and 10.'), '#default_value' => variable_get('fancybox_zoom_speed_change', 0.3), ); $form['fancybox']['fancybox_easing_in'] = array( '#type' => 'select', '#title' => t('Fancybox zoom in ease animation'), '#description' => t('Easing animation used for zoom in.'), '#options' => $easing_options, '#default_value' => variable_get('fancybox_easing_in', _fancybox_default_animation("in")), ); $form['fancybox']['fancybox_easing_out'] = array( '#type' => 'select', '#title' => t('Fancybox zoom out ease animation'), '#description' => t('Easing animation used for zoom out.'), '#options' => $easing_options, '#default_value' => variable_get('fancybox_easing_out', _fancybox_default_animation("out")), ); $form['fancybox']['fancybox_easing_change'] = array( '#type' => 'select', '#title' => t('Fancybox change gallery items ease animation'), '#description' => t('Easing animation used for changing gallery items.'), '#options' => $easing_options, '#default_value' => variable_get('fancybox_easing_change', _fancybox_default_animation("change")), ); $form['fancybox']['fancybox_overlay_show'] = array( '#type' => 'checkbox', '#title' => t('Fancybox overlay show'), '#description' => t('Enable to show the overlay'), '#default_value' => variable_get('fancybox_overlay_show', FALSE), ); $form['fancybox']['fancybox_overlay_opacity'] = array( '#type' => 'select', '#title' => t('Fancybox overlay opacity'), '#description' => t('Overlay opacity. Select a value between 0.0 and 1.0.'), '#options' => $opacity_options, '#default_value' => variable_get('fancybox_overlay_opacity', 0.8), ); $form['fancybox']['fancybox_hide_on_content_click'] = array( '#type' => 'checkbox', '#title' => t('Fancybox hide on content click'), '#description' => t('Enable to hides FancyBox when clicked on opened item.'), '#default_value' => variable_get('fancybox_hide_on_content_click', TRUE), ); $form['fancybox']['fancybox_center_on_scroll'] = array( '#type' => 'checkbox', '#title' => t('Fancybox center on scroll'), '#description' => t('Enable to center content when user scrolls page.'), '#default_value' => variable_get('fancybox_center_on_scroll', TRUE), ); return system_settings_form($form); } /** * Validation function for the general configuration form. * * Ensure that padding and speeds are numeric. */ function fancybox_general_settings_form_validate($form, &$form_state) { if ($form_state['values']['op'] == 'Save configuration') { $padding = $form_state['values']['fancybox_padding']; $zoom_speed_in = $form_state['values']['fancybox_zoom_speed_in']; $zoom_speed_out = $form_state['values']['fancybox_zoom_speed_out']; $zoom_speed_change = $form_state['values']['fancybox_zoom_speed_change']; if (!is_numeric($padding) || $padding < 0) { form_set_error('fancybox_padding', t('You must enter a value greater than or equal to 0.')); } if (!is_numeric($zoom_speed_in) || $zoom_speed_in <= 0 || $zoom_speed_in >= 10) { form_set_error('fancybox_zoom_speed_in', t('You must enter a duration between 0 and 10 seconds.')); } if (!is_numeric($zoom_speed_out) || $zoom_speed_out <= 0 || $zoom_speed_out >= 10) { form_set_error('fancybox_zoom_speed_out', t('You must enter a duration between 0 and 10 seconds.')); } if (!is_numeric($zoom_speed_change) || $zoom_speed_change <= 0 || $zoom_speed_change >= 10) { form_set_error('fancybox_zoom_speed_change', t('You must enter a duration between 0 and 10 seconds.')); } } }