function ctools_passthrough

Provide a hook passthrough to included files.

To organize things neatly, each CTools tool gets its own toolname.$type.inc file. If it exists, it's loaded and ctools_$tool_$type() is executed. To save time we pass the $items array in so we don't need to do array addition. It modifies the array by reference and doesn't need to return it.

4 calls to ctools_passthrough()
ctools_cron in ./ctools.module
Implementation of hook_cron. Clean up old caches.
ctools_ctools_plugin_type in ./ctools.module
Implements hook_ctools_plugin_type().
ctools_menu in ./ctools.module
Implements hook_menu().
ctools_theme in ./ctools.module
Implements hook_theme().

File

includes/utility.inc, line 20

Code

function ctools_passthrough($module, $type, &$items) {
    $files = file_scan_directory(drupal_get_path('module', $module) . '/includes', '/\\.' . $type . '\\.inc$/', array(
        'key' => 'name',
    ));
    foreach ($files as $file) {
        require_once DRUPAL_ROOT . '/' . $file->uri;
        list($tool) = explode('.', $file->name, 2);
        $function = $module . '_' . str_replace('-', '_', $tool) . '_' . str_replace('-', '_', $type);
        if (function_exists($function)) {
            $function($items);
        }
    }
}