From 453032c1171756066f0d2de2367b0098e9fd8d46 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Thu, 22 Apr 2010 22:36:01 +0000 Subject: #692950 by effulgentsia, chx, aaron, catch, moshe weitzman, sun: Use hook_module_implements_alter() to allow modules to alter the weight of hooks in module_implements(). --- modules/system/system.api.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'modules/system/system.api.php') diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 4c97cd757..6faa6afb6 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -981,6 +981,32 @@ function hook_mail_alter(&$message) { } } +/** + * Alter the registry of modules implementing a hook. + * + * This hook is invoked during module_implements(). A module may implement this + * hook in order to reorder the implementing modules, which are otherwise + * ordered by the module's system weight. + * + * @param &$implementations + * An array keyed by the module's name. The value of each item corresponds + * to a $group, which is usually FALSE, unless the implementation is in a + * file named $module.$group.inc. + * @param $hook + * The name of the module hook being implemented. + */ +function hook_module_implements_alter(&$implementations, $hook) { + if ($hook == 'rdf_mapping') { + // Move my_module_rdf_mapping() to the end of the list. module_implements() + // iterates through $implementations with a foreach loop which PHP iterates + // in the order that the items were added, so to move an item to the end of + // the array, we remove it and then add it. + $group = $implementations['my_module']; + unset($implementations['my_module']); + $implementations['my_module'] = $group; + } +} + /** * Alter the information parsed from module and theme .info files * -- cgit v1.2.3