From 971a0e24aa6344da7ae07f476ed3fb371bd744d0 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 16 Jan 2005 18:44:49 +0000 Subject: - Patch #14731 by chx: made it possible to rewrite node queries. --- includes/module.inc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'includes') diff --git a/includes/module.inc b/includes/module.inc index 820fdf7e9..b2b1354a7 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -136,6 +136,30 @@ function module_hook($module, $hook) { return function_exists($module .'_'. $hook); } +/** + * Determine which modules are implementing a hook. + * + * @param $hook + * The name of the hook (e.g. "help" or "menu"). + * @return + * An array with the names of the modules which are implementing this hook. + */ +function module_implements($hook) { + static $implementations; + + if (!isset($implementations[$hook])) { + $implementations[$hook] = array(); + $list = module_list(); + foreach ($list as $module) { + if (module_hook($module, $hook)) { + $implementations[$hook][] = $module; + } + } + } + + return $implementations[$hook]; +} + /** * Invoke a hook in a particular module. * -- cgit v1.2.3