drupal7 查看哪些模块实现了某个钩子

module_implements($hook)

可参考函数module_invoke_all

function module_invoke_all($hook) {
  $args = func_get_args();
  // Remove $hook from the arguments.
  unset($args[0]);
  $return = array();
  foreach (module_implements($hook) as $module) {
    $function = $module . '_' . $hook;
    if (function_exists($function)) {
      $result = call_user_func_array($function, $args);
      if (isset($result) && is_array($result)) {
        $return = array_merge_recursive($return, $result);
      }
      elseif (isset($result)) {
        $return[] = $result;
      }
    }
  }

  return $return;
}

 

posted @ 2017-11-03 16:17  jiafeng  阅读(180)  评论(0编辑  收藏  举报