Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Instead of checking what page the user is on via hook_init() to add Thickbox, it should be contextual....
/**
* Implementation of hook_init().
*/
function thickbox_init() {
// Code from the block_list funtion in block.module.
// If the path doesn't match any of the exeptions, load header files.
$path = drupal_get_path_alias($_GET['q']);
$regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote(variable_get('thickbox_pages', ''), '/')) .')$/';
// Compare with the internal and path alias (if any).
$page_match = preg_match($regexp, $path);
if ($path != $_GET['q']) {
$page_match = $page_match || preg_match($regexp, $_GET['q']);
}
if (!$page_match) {
_thickbox_doheader();
}
}
Instead of automatically adding Thickbox on a selection of pages, Thickbox should be added contextually based on what's in there with an API.