Index: README.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/colorbox/README.txt,v retrieving revision 1.8.2.1 diff -u -p -u -p -r1.8.2.1 README.txt --- README.txt 28 Jun 2010 17:30:26 -0000 1.8.2.1 +++ README.txt 20 Aug 2010 05:49:23 -0000 @@ -126,6 +126,25 @@ http://colorpowered.com/colorbox/#help_p The default style in Colorbox module does not have this problem. +Hooks: +----- +hook_colorbox_form_access($form_id); + +Allow other modules to control access to forms opening in Colorbox. + +Example: +/** + * Implementation of hook_colorbox_form_access(). + */ +function my_module_colorbox_form_access($form_id) { + $access = FALSE; + if ($form_id == 'forward_form') { + return user_access('access forward'); + } + return $access; +} + + Contributions: ------------- * Porting all features from the Thickbox module, @@ -138,4 +157,4 @@ Contributions: Last updated: ------------ -$Id: README.txt,v 1.8.2.1 2010/06/28 17:30:26 frjo Exp $ \ No newline at end of file +$Id: README.txt,v 1.8.2.1 2010/06/28 17:30:26 frjo Exp $ Index: colorbox.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/colorbox/colorbox.module,v retrieving revision 1.19.2.3 diff -u -p -u -p -r1.19.2.3 colorbox.module --- colorbox.module 25 Jul 2010 17:35:28 -0000 1.19.2.3 +++ colorbox.module 20 Aug 2010 05:49:23 -0000 @@ -94,6 +94,9 @@ function colorbox_menu() { * Colorbox menu access check. */ function _colorbox_form_page_access($form_id) { + $access = FALSE; + + // First check if this is one of the forms Colorbox support out of the box. switch ($form_id) { case 'contact_mail_page': $access = user_access('access site-wide contact form'); @@ -106,9 +109,15 @@ function _colorbox_form_page_access($for case 'user_login_block': $access = user_is_anonymous(); break; - default: - // All other forms get no access. - $access = FALSE; + } + + // Invoke hook_colorbox_form_access for all modules. + if (!$access) { + foreach (module_implements('colorbox_form_access') as $module) { + if ($access = module_invoke($module, 'colorbox_form_access', $form_id)) { + return $access; + } + } } return $access;