*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
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

webchick - February 7, 2008 - 20:50
Priority:normal» critical

That would be critical. Thanks for the report.

#2

Nick Lewis - March 10, 2008 - 17:50
Title:hook_hook_info and hook_action_info are undocumented» Undocumented Drupal 6 hooks

In addition to those hooks, hook_theme_registry_alter is undocumented. Am searching for other hooks that aren't documented.

#3

Nick Lewis - March 10, 2008 - 18:28
Title:Undocumented Drupal 6 hooks» *Twenty One* undocumented hooks in Drupal 6

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

dvessel - March 13, 2008 - 03:40

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

webchick - March 17, 2008 - 02:17

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

oadaeh - April 8, 2008 - 14:20

These appear to now have documentation: hook_schema, hook_requirements, hook_enable, hook_disable, hook_uninstall.

#7

NancyDru - April 13, 2008 - 15:29

Even though I reported it ages ago, hook_term_path is still undocumented.

Hook_submit is still documented even though it is gone.

#8

boydjd - April 15, 2008 - 06:14

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

NancyDru - April 30, 2008 - 15:48

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_caches
hook_check_http_request
hook_get_vocabularies
hook_get_tree
hook_get_parents
hook_term_path
hook_status
hook_update_last_removed
hook_form_all
hook_language_name
hook_search_page
hook_system_update

#10

NancyDru - April 29, 2008 - 22:51

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

NancyDru - April 30, 2008 - 00:06

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

webchick - April 30, 2008 - 00:14

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

NancyDru - April 30, 2008 - 08:27

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

webchick - April 30, 2008 - 14:09

It might be the newline between the "*/" and the "function" on that one. That's the only thing I can see.

#15

NancyDru - April 30, 2008 - 14:44

Well, I guess we'll find out. I just removed that. When does it next roll out?

#16

webchick - April 30, 2008 - 14:58

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

sepeck - April 30, 2008 - 16:07

it depends on if drumm is working on it. I know he had plans for it this week.

#18

NancyDru - April 30, 2008 - 17:04

So it is basically, "We'll see it when we see it?"

#19

Island Usurper - May 2, 2008 - 15:23

hook_hook_info() wasn't in DRUPAL-6--1, but I found it in HEAD. Committed to D6 branch.

#20

NancyDru - May 3, 2008 - 00:31

@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.

 
 

Drupal is a registered trademark of Dries Buytaert.