5 * Contains general utility functions for CTools that do not need to be
8 * In particular, things that are only needed during hook_menu() and
9 * hook_theme() are placed here.
13 * Provide a hook passthrough to included files.
15 * To organize things neatly, each CTools tool gets its own toolname.$type.inc
16 * file. If it exists, it's loaded and ctools_$tool_$type() is executed.
17 * To save time we pass the $items array in so we don't need to do array
18 * addition. It modifies the array by reference and doesn't need to return it.
20 function _ctools_passthrough(&$items, $type = 'theme') {
21 $files = drupal_system_listing('/\.' .
$type .
'\.inc$/', drupal_get_path('module', 'ctools') .
'/includes', 'name', 0);
22 foreach ($files as
$file) {
23 require_once DRUPAL_ROOT .
'/' .
$file->uri
;
24 list($tool) = explode('.', $file->name
, 2);
26 $function = 'ctools_' .
str_replace ('-', '_', $tool) .
'_' .
str_replace('-', '_', $type);
27 if (function_exists($function)) {
34 * Implementation of hook_theme_registry_alter()
36 function ctools_theme_registry_alter(&$registry) {
37 // Move this one last last last so it can catch changes made by modules and themes.
38 $key = array_search('ctools_preprocess_page', $registry['page']['preprocess functions']);
40 unset($registry['page']['preprocess functions'][$key]);
42 $registry['page']['preprocess functions'][] = 'ctools_preprocess_page';