You are here

function fancybox_active in fancyBox 7.2

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

Determines if the fancyBox plugin should be loaded.

Parameters

$path string (optional): An optional path. If not passed in, will use the current path.

Return value

TRUE if fancyBox is active, FALSE otherwise.

1 call to fancybox_active()
fancybox_init in ./fancybox.module
Implements hook_init().

File

./fancybox.module, line 547
Provides the fancyBox jQuery plugin, a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages, and an extensive settings page for configuring fancyBox settings and how fancyBox…

Code

function fancybox_active($path = NULL) {
  $settings = variable_get('fancybox_settings');
  $deactivated_pages = $settings['settings']['deactivated_pages'];
  if (!isset($path)) {
    $path = drupal_get_path_alias($_GET['q']);
  }

  // Need the library loaded on this page.
  if ($path == 'admin/config/user-interface/fancybox') {
    return TRUE;
  }
  $page_match = drupal_match_path($path, $deactivated_pages);
  if ($path != $_GET['q']) {
    $page_match = $page_match || drupal_match_path($_GET['q'], $deactivated_pages);
  }
  return !$page_match;
}