diff --git a/colorbox.api.php b/colorbox.api.php index 83ead10..61495ba 100644 --- a/colorbox.api.php +++ b/colorbox.api.php @@ -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; + } +} diff --git a/colorbox.module b/colorbox.module index da22f8a..e3d94d2 100644 --- a/colorbox.module +++ b/colorbox.module @@ -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; }