=== modified file 'includes/module.inc' --- includes/module.inc 2007-04-17 07:19:38 +0000 +++ includes/module.inc 2007-04-30 22:39:45 +0000 @@ -341,10 +341,24 @@ function module_implements($hook, $sort * The return value of the hook implementation. */ function module_invoke() { + static $includes; $args = func_get_args(); $module = array_shift($args); $hook = array_shift($args); $function = $module .'_'. $hook; + if (!isset($includes[$module][$hook])) { + $underscore = strpos($hook, '_'); + if ($underscore !== FALSE) { + $include = substr($hook, 0, $underscore); + $filename = dirname(drupal_get_filename('module', $module)) . "/$include.inc"; + $included = FALSE; + if (file_exists($filename)) { + include_once($filename); + $included = TRUE; + } + $includes[$module][$hook] = $included; + } + } if (module_hook($module, $hook)) { return call_user_func_array($function, $args); }