Same name and namespace in other branches
- 7.x-1.x colorbox.module \_colorbox_active() 1 comment
Check if Colorbox should be active for the current URL.
Return value
bool 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_init in ./
colorbox.module - Implements hook_init().
File
-
./
colorbox.module, line 173
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 function 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;
// Allow other modules to change the state of colorbox for the current URL.
drupal_alter('colorbox_active', $page_match);
return $page_match;
}