Commit 97a4ff10 authored by stBorchert's avatar stBorchert Committed by frjo
Browse files

Issue #2374425 by stBorchert: Added Allow other modules to enable colorbox on specific paths.

parent 4ccb873a
......@@ -27,3 +27,18 @@ function hook_colorbox_settings_alter(&$settings, &$style) {
$style = 'mystyle';
}
}
/**
* Allows to override activation of Colobox for the current URL.
*
* @param $active
* A boolean indicating whether colorbox should be active for the current
* URL or not.
*/
function hook_colorbox_active_alter(&$active) {
$path = drupal_get_path_alias($_GET['q']);
if (drupal_match_path($path, 'admin/config/colorbox_test')) {
// Enable colorbox for this URL.
$active = TRUE;
}
}
......@@ -152,6 +152,9 @@ function _colorbox_active() {
}
$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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment