*Twenty One* undocumented hooks in Drupal 6
mbutcher - February 5, 2008 - 02:34
| Project: | Documentation |
| Component: | Documentation in CVS |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Two of the hooks in actions.inc are undocumented: hook_hook_info and hook_action_info. Since these functions are needed for modules to implement actions (and thus triggers), they should probably be present in the API docs.

#1
That would be critical. Thanks for the report.
#2
In addition to those hooks, hook_theme_registry_alter is undocumented. Am searching for other hooks that aren't documented.
#3
Did a search of the d6 codebase's calls to module_invoke, and uncovered this heap of undocumented hooks (hooks cannot be found at http://api.drupal.org/api/file/developer/hooks/core.php/6 ) .
After the missing hook is the file, and line I found them. Many of these hooks are quite useful. In addition, I suspect a number of them are undocumented for versions earlier than 6.
1. hook_hook_info (trigger.module, 28)
2. hook_action_info ((actions.inc, 156)
3. hook_theme_registry_alter
4. hook_actions_delete (actions.inc, 364)
5. hook_schema (common.inc, 3046)
6. hook_locale (locale.inc, 486)
7. hook_flush_caches (common.inc, 3525)
8. hook_check_http_request (common.inc, 425)
9. hook_requirements (install.inc 720)
10. hook_enable (module.inc, 306)
11. hook_disable (module.inc, 333)
12. hook_get_vocabularies (blogapi, 398)
13. hook_get_tree (blogapi, 402)
14. hook_get_parents(blogapi, 405)
15. hook_status (block, 446)
16. hook_update_last_removed (update.php, 219)
17. hook_uninstall (install.inc, 691)
18. hook_form_all (node.module, 1846)
19. hook_language_name (path.admin.inc, 48)
20. hook_search_page (serach.module, 1147)
21. hook_system_update (system.admin.inc, 312)
#4
I'll take care of hook_theme_registry_alter. I promised to do it a long time ago but I completely forgot about it.
The others I have no clue on.
#5
I'd like to just remind everyone that anyone with a CVS account can update this documentation. The files to update are in contributions/docs/developer in files like core.php, etc. Both in the DRUPAL-6--1 and HEAD branches.
Even if you think you have no idea how a hook works, simply copy/pasting an entry for it and reading the surrounding code and making an initial stab at some text is better than the big ol' nothing we have now. Work with some people in #drupal if you have questions; chances are, someone in there knows and this is a great way to get your name out there as a contributor!
#6
These appear to now have documentation: hook_schema, hook_requirements, hook_enable, hook_disable, hook_uninstall.
#7
Even though I reported it ages ago, hook_term_path is still undocumented.
Hook_submit is still documented even though it is gone.
#8
Still to complete:
hook_theme_registry_alter
hook_actions_delete (actions.inc, 364)
hook_locale
hook_flush_caches
hook_check_http_request
hook_requirements
hook_enable
hook_disable
hook_get_vocabularies
hook_get_tree
hook_get_parents
hook_status
hook_update_last_removed
hook_uninstall
hook_form_all
hook_language_name
hook_search_page
hook_system_update
#9
I checked again and some of those were done. Still to go:
hook_theme_registry_alter
hook_actions_delete (actions.inc, 364)
hook_locale
hook_flush_cacheshook_check_http_request
hook_get_vocabularieshook_get_treehook_get_parentshook_term_pathhook_status
hook_update_last_removed
hook_form_all
hook_language_name
hook_search_page
hook_system_update
#10
If someone can point me to a post that tells me how to update the docs (yes, I have a CVS account), and if there are special formatting requirements, I'll take a shot at a few of them.
#11
Well, if I managed to do it right, hook_flush_caches and hook_term_path have been added to both HEAD and DRUPAL-6--1
#12
Yep, you did it right. :) I don't know if docs exist, but you basically make changes and commit it, like any other file.
#13
When do they roll up? I won't do any more until I see how those turned out.
*EDIT*: I see both of them in the APIs now, but the text for hook_term_path is not displayed. What did I do wrong?
#14
It might be the newline between the "*/" and the "function" on that one. That's the only thing I can see.
#15
Well, I guess we'll find out. I just removed that. When does it next roll out?
#16
http://api.drupal.org/support says "If documentation does not match the Drupal source code after a half day, file an issue in the infrastructure project.".. not sure how often it actually runs tho.
#17
it depends on if drumm is working on it. I know he had plans for it this week.
#18
So it is basically, "We'll see it when we see it?"
#19
hook_hook_info() wasn't in DRUPAL-6--1, but I found it in HEAD. Committed to D6 branch.
#20
@Island Usurper: are you sure it's a 6.x function?
*EDIT* Never mind, I see it's used in at least: comment, node, system, taxonomy, and user.