I use D7 and need 2 different modules to parse article text on save. For simplicity's sake let's say module_one changes all f's to z's and module_two changes all foos to bars. So basically "F foo fo foo" is to become "Z bar zo bar". To accomplish that I need module_two node_presave event to fire before module1. Otherwise the result will be something like "Z zoo zo zoo". But hook_module_implements_alter() doesn't seem to do the thing. I write it like this:
function module_one_module_implements_alter(&$implementations, $hook) {
if ($hook == 'node_presave') {
// Move module_one_node_presave() 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['module_one'];
unset($implementations['module_one']);
$implementations['module_one'] = $group;
}
}
This hook executes but I still get module_one's node_presave hook executed before module_two's. So what am I doing wrong?