module_implements

Versions
4.6
module_implements($hook)
4.7
module_implements($hook, $sort = FALSE)
5 – 6
module_implements($hook, $sort = FALSE, $refresh = FALSE)
7
module_implements($hook, $sort = FALSE, $reset = FALSE)

Determine which modules are implementing a hook.

Parameters

$hook The name of the hook (e.g. "help" or "menu").

Return value

An array with the names of the modules which are implementing this hook.

Related topics

▾ 3 functions call module_implements()

module_invoke_all in includes/module.inc
Invoke a hook in all enabled modules that implement it.
search_preprocess in modules/search.module
Invokes hook_search_preprocess() in modules.
_db_rewrite_sql in includes/database.inc
Helper function for db_rewrite_sql.

Code

includes/module.inc, line 147

<?php
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];
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.