Issue #1216758 by tim.plunkett: Add module and hook as formal parameters in module_invoke().

merge-requests/26/head
webchick 2011-09-05 11:11:17 -07:00
parent 6b54665a59
commit a500758588
1 changed files with 4 additions and 5 deletions

View File

@ -786,10 +786,9 @@ function module_implements_write_cache() {
* @return * @return
* The return value of the hook implementation. * The return value of the hook implementation.
*/ */
function module_invoke() { function module_invoke($module, $hook) {
$args = func_get_args(); $args = func_get_args();
$module = $args[0]; // Remove $module and $hook from the arguments.
$hook = $args[1];
unset($args[0], $args[1]); unset($args[0], $args[1]);
if (module_hook($module, $hook)) { if (module_hook($module, $hook)) {
return call_user_func_array($module . '_' . $hook, $args); return call_user_func_array($module . '_' . $hook, $args);
@ -808,9 +807,9 @@ function module_invoke() {
* An array of return values of the hook implementations. If modules return * An array of return values of the hook implementations. If modules return
* arrays from their implementations, those are merged into one array. * arrays from their implementations, those are merged into one array.
*/ */
function module_invoke_all() { function module_invoke_all($hook) {
$args = func_get_args(); $args = func_get_args();
$hook = $args[0]; // Remove $hook from the arguments.
unset($args[0]); unset($args[0]);
$return = array(); $return = array();
foreach (module_implements($hook) as $module) { foreach (module_implements($hook) as $module) {