You are here

function fancybox_menu in fancyBox 5

Same name and namespace in other branches
  1. 6 fancybox.module \fancybox_menu()
  2. 7.2 fancybox.module \fancybox_menu()
  3. 7 fancybox.module \fancybox_menu()

Implementation of hook_menu().

File

./fancybox.module, line 10

Code

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');

      /*drupal_add_js('
        $(document).ready(
          function(){
            $("a'.variable_get('fancybox_class_id', '').'")
            .fancybox();
          }
        );',
        '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;
}