You are here

function fancybox_active in fancyBox 6

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

Check whether Fancybox should be initialized for the current URL.

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

File

./fancybox.module, line 138
Provides the Fancybox jQuery plugin for displaying images, HTML content and multimedia in an elegant box.

Code

function fancybox_active($settings) {

  // If PHP is selected, evaluate it.
  if ($settings['activation']['activation_type'] == 'php') {
    return drupal_eval($settings['activation']['activation_pages']);
  }

  // Compare defined paths with the current path.
  $path = drupal_get_path_alias($_GET['q']);
  $page_match = drupal_match_path($path, $settings['activation']['activation_pages']);
  if ($path != $_GET['q']) {
    $page_match = $page_match || drupal_match_path($_GET['q'], $settings['activation']['activation_pages']);
  }

  // Decide whether to include or exclude pages.
  if ($settings['activation']['activation_type'] == 'exclude') {
    return !$page_match;
  }
  else {
    return $page_match;
  }
}