Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Custom helpers.
- *
- * Allows you to run module_invoke_all() while skipping some modules to avoid infinite loops.
- */
- function custom_module_invoke_all($hook, array $modules_blacklist) {
- $args = func_get_args();
- // Remove $hook from the arguments.
- unset($args[0]);
- $return = array();
- foreach (module_implements($hook) as $module) {
- if (in_array($module, $modules_blacklist) {
- continue;
- }
- $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;
- }
Advertisement
Add Comment
Please, Sign In to add comment