You are here

function _colorbox_active in Colorbox 7

Same name and namespace in other branches
  1. 6 colorbox.module \_colorbox_active()
  2. 7.2 colorbox.module \_colorbox_active()

Check if Colorbox should be active for the current URL.

Return value

TRUE if Colorbox should be active for the current page.

2 calls to _colorbox_active()
colorbox_handler_field_colorbox::render in views/colorbox_handler_field_colorbox.inc
Render the trigger field and its linked popup information.
_colorbox_doheader in ./colorbox.module
Loads the various js and css files.

File

./colorbox.module, line 147
A light-weight, customizable lightbox plugin for jQuery 1.3

Code

function _colorbox_active() {

  // Make it possible deactivate Colorbox with
  // parameter ?colorbox=no in the url.
  if (isset($_GET['colorbox']) && $_GET['colorbox'] == 'no') {
    return FALSE;
  }

  // Code from the block_list funtion in block.module.
  $path = drupal_get_path_alias($_GET['q']);
  $colorbox_pages = variable_get('colorbox_pages', "admin*\nimagebrowser*\nimg_assist*\nimce*\nnode/add/*\nnode/*/edit\nprint/*\nprintpdf/*\nsystem/ajax\nsystem/ajax/*");

  // Compare with the internal and path alias (if any).
  $page_match = drupal_match_path($path, $colorbox_pages);
  if ($path != $_GET['q']) {
    $page_match = $page_match || drupal_match_path($_GET['q'], $colorbox_pages);
  }
  $page_match = variable_get('colorbox_visibility', 0) == 0 ? !$page_match : $page_match;
  return $page_match;
}