View source
<?php
function fancybox_menu($may_cache) {
$path = drupal_get_path('module', 'fancybox');
$items = array();
if (!$may_cache) {
if (variable_get('fancybox_class_id', '') != '') {
drupal_add_css($path . '/fancybox/jquery.fancybox.css');
drupal_add_js($path . '/fancybox/jquery.easing.1.3.js');
drupal_add_js($path . '/fancybox/jquery.fancybox-1.2.1.pack.js');
drupal_add_js('
$(document).ready(
function(){
$("a' . variable_get('fancybox_class_id', '') . '").fancybox({
padding:' . variable_get('fancybox_padding', '0') . ',
zoomOpacity:' . variable_get('fancybox_zoomopacity', 'true') . ',
zoomSpeedIn:' . variable_get('fancybox_zoomspeedin', '300') . ',
zoomSpeedOut:' . variable_get('fancybox_zoomspeedout', '300') . ',
zoomSpeedChange:' . variable_get('fancybox_zoomspeedchange', '300') . ',
easingIn:"' . variable_get('fancybox_easingin', 'easeOutBack') . '",
easingOut:"' . variable_get('fancybox_easingout', 'easeInBack') . '",
overlayShow:' . variable_get('fancybox_overlayshow', 'true') . ',
overlayOpacity:' . variable_get('fancybox_overlayopacity', '10') . ',
hideOnContentClick:' . variable_get('fancybox_hideoncontentclick', 'true') . '
});
}
);', 'inline');
}
$items[] = array(
'path' => 'admin/settings/fancybox',
'title' => t('Fancybox'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'fancybox_admin_settings',
),
'access' => user_access('administer fancybox'),
'description' => t('Settings page fo fancybox.'),
);
}
return $items;
}
function fancybox_perm() {
return array(
'administer fancybox',
);
}
function fancybox_admin_settings() {
$form['fancybox']['fancybox_class_id'] = array(
'#type' => 'textfield',
'#title' => t('Css classe or id'),
'#description' => t('The css class or ID to consider for fancybox. Fancybox will insert this value after the tag a.<br />Example: insert .myimageclass and fancybox will output a.image. Your markup has to be like this: <a ...><img class="myimageclass" ... >.'),
'#default_value' => variable_get('fancybox_class_id', ''),
);
$form['fancybox']['fancybox_hideoncontentclick'] = array(
'#type' => 'textfield',
'#title' => t('Hide on content click'),
'#description' => t('Hides FancyBox when cliked on opened item (true or false).'),
'#default_value' => variable_get('fancybox_hideoncontentclick', 'true'),
);
$form['fancybox']['fancybox_padding'] = array(
'#type' => 'textfield',
'#title' => t('Fancybox padding'),
'#default_value' => variable_get('fancybox_padding', '0'),
);
$form['fancybox']['fancybox_zoomopacity'] = array(
'#type' => 'textfield',
'#title' => t('Fancybox zoom opacity'),
'#default_value' => variable_get('fancybox_zoomopacity', 'true'),
);
$form['fancybox']['fancybox_zoomspeedin'] = array(
'#type' => 'textfield',
'#title' => t('Fancybox zoom speed in'),
'#default_value' => variable_get('fancybox_zoomspeedin', '300'),
);
$form['fancybox']['fancybox_zoomspeedout'] = array(
'#type' => 'textfield',
'#title' => t('Fancybox zoom speed out'),
'#default_value' => variable_get('fancybox_zoomspeedout', '300'),
);
$form['fancybox']['fancybox_zoomspeedchange'] = array(
'#type' => 'textfield',
'#title' => t('Fancybox zoom speed change'),
'#description' => t('Speed in miliseconds of the animation when changing gallery items.'),
'#default_value' => variable_get('fancybox_zoomspeedchange', '300'),
);
$form['fancybox']['fancybox_easingin'] = array(
'#type' => 'textfield',
'#title' => t('Fancybox zoom speed change'),
'#description' => t('Easing used for animations. Insert easeOutBack or none.'),
'#default_value' => variable_get('fancybox_easingin', 'easeOutBack'),
);
$form['fancybox']['fancybox_easingout'] = array(
'#type' => 'textfield',
'#title' => t('Fancybox zoom speed change'),
'#description' => t('Easing used for animations. Insert easeInBack or none.'),
'#default_value' => variable_get('fancybox_easingout', 'easeInBack'),
);
$form['fancybox']['fancybox_overlayshow'] = array(
'#type' => 'textfield',
'#title' => t('Fancybox overlay show'),
'#default_value' => variable_get('fancybox_overlayshow', 'true'),
);
$form['fancybox']['fancybox_overlayopacity'] = array(
'#type' => 'textfield',
'#title' => t('Fancybox overlay opacity'),
'#default_value' => variable_get('fancybox_overlayopacity', '10'),
);
return system_settings_form($form);
}