module_invoke_all not returning all modules
I'm creating a module wich provides a separate node overview page for each content type. My problem lies in trying to recreate the no开发者_高级运维de operations dropdown.
In the node module this is done by calling the module_invoke_all function with the 'node_operations' hook. This returns an array of all modules that implement the 'node_operations' hook. In my case the following two modules: 'node' and 'nodewords'.
When I call module_invoke_all('node_operations') in my module, it returns only the 'nodewords' module, not the 'node' module. This is because the 'node_node_operations' function does not exist.
Can anyone explain this behavior?
It looks like the hook is in node.admin.inc, which is not automatically included. See http://api.drupal.org/api/drupal/modules--node--node.admin.inc/function/node_node_operations/7
This is imho a bug, you should look if there already is an issue and if not, create a new one.
Anyway, as a workaround, you can include the node.admin.inc file like this before calling the hook:
<?php
module_load_include('inc', 'node', 'node.admin');
?>
(Yeah, weird syntax ;))
精彩评论