function skinr_invoke_all in Skinr 7.2
Same name and namespace in other branches
- 8.2 skinr.module \skinr_invoke_all()
Invoke a hook in all enabled modules and themes that implement it.
Replacement for module_invoke_all() that only invokes modules that implement the current version of Skinr API. It also supports $module.skinr.inc files in themes and custom paths.
Parameters
$hook: The name of the hook to invoke.
...: Arguments to pass to the hook.
Return value
An array of return values of the hook implementations. If modules return arrays from their implementations, those are merged into one array.
14 calls to skinr_invoke_all()
- SkinrApiTestCase::testSkinrInvokeAll in tests/
skinr.test - Test that module_invoke_all() can load a hook defined in hook_hook_info().
- SkinrPanelsTestCase::testPanelsDatabase in skinr_panels/
tests/ skinr_panels.test - Tests panels plugin.
- SkinrUIPluginTestCase::testBlock in tests/
skinr_ui.test - Tests block plugin.
- SkinrUIPluginTestCase::testComment in tests/
skinr_ui.test - Tests comment plugin.
- SkinrUIPluginTestCase::testNode in tests/
skinr_ui.test - Tests node plugin.
File
- ./
skinr.module, line 524 - Handles core Skinr functionality.
Code
function skinr_invoke_all($hook) {
$args = func_get_args();
// Remove $hook from the arguments.
unset($args[0]);
$return = array();
foreach (skinr_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;
}