As per http://drupal.org/node/515870 (and just because it's a good idea), we need to make sure that all hooks in Drupal 7 have documentation before release.
As an aid to doing that, I grepped the source of Drupal 7 and compiled a list of hooks called using module_invoke(), module_invoke_all(), drupal_alter(), node_invoke(), user_invoke(), and via module_implements() loops. I am not sure it is entirely accurate or complete, but it's a lot better than nothing. See attached file.
Note that I made up names for at least one, such as hook_query_TAG_alter. It may be documented under another name.
The next step in this task is to make sure that all of these hooks actually have documentation (header and example) in files modules/whatever/whatever.api.php so that they will appear on api.drupal.org.
My approach will be to compile a list of hooks that are documented (again using a script/grep), and compare to the list of hooks that should be. Then probably will have to verify that they match, and then manually decide what is appropriate to do in cases where they don't.
Comment | File | Size | Author |
---|---|---|---|
#4 | tofix.txt | 2.96 KB | jhodgdon |
#2 | differences.txt | 2.23 KB | jhodgdon |
#1 | dochooks.txt | 6.08 KB | jhodgdon |
allhooks.txt | 6.14 KB | jhodgdon |
Comments
Comment #1
jhodgdonOK, here's a list of the hooks that have documentation (I grepped in *.api.php files for "function hook_").
Comment #2
jhodgdonAnd here's a diff file between the two.
Anything with a < means I think it's a hook and I think it is NOT currently documented.
Anything with a > means it is currently documented but I am not sure if it's really a hook (but it probably just means I missed it).
Gosh, that's a big list to go through and see what's really happening!!!!!!!!!
Sigh.
Comment #3
jhodgdonNOTE: I am making an annotated list of what needs to be done from the differences file - checking through all of them... will report back shortly...
There were a few left-over files in my area (old versions, etc.), so a few of the hooks were bogus... Also, I apparently missed boostrap_invoke() and _field_invoke_*() functions as more ways to invoke hooks. And there are of course a few places where someone didn't use module_invokes() or any of those other things at all, sigh.
Comment #4
jhodgdonOK. Phew.
There are about 30 hooks that need documentation.
See attached file for the list, along with notes of where they are invoked. A few separate issues have been filed, as noted. Otherwise, they are open for patches...
Comment #5
jhodgdonNow that there's a list of hooks that need doc, I guess it's a critical issue. Probably even a critical meta-issue.
I suggest that anyone who wants to help with this issue
a) File a separate issue with a title something like "hook_abc is not documented", with component "documentation", project Drupal, category "bug report", priority "normal" (so as not to clutter up the critical issue queue). You could put a couple of related hooks into the same issue if you want.
b) Comment here, with a link to the issue, explaining which hooks you have taken charge of.
c) This file has all kinds of helpful information on where the hooks are called, etc.: http://drupal.org/files/issues/tofix.txt
Here are the hooks that need doc. As people file issues, I'll update this list with links to the issues.
UPDATE - As of April 23, 2010, all of the issues here at least have patches, except the extra issue at the bottom about hooks that lack function bodies in the Field API! Most patches have been reviewed even; a few still need review. YIPPEE!!!!
hook_ajax_render_alter- FIXED - #713794: hook_ajax_render_alter() is undocumentedhook_archiver_info_alter- FIXED - #708574: hook_archiver_info_alter() is not documentedhook_batch_alter- FIXED - #717602: hook_batch_alter() is undocumentedhook_countries_alter- FIXED - #717666: hook_countries_alter() is undocumentedhook_cron_queue_info_alter- FIXED - #718648: hook_cron_queue_info_alter() is not documentedhook_date_format_types_alter- FIXED - #718894: hook_date_format_types_alter() is not documentedhook_field_attach_purge- FIXED - #776694: hook_field_attach_purge is not documentedhook_field_extra_fields_alter- FIXED - #719432: hook_field_extra_fields_alter() is undcoumentedhook_field_languages- Went away - see #776982: hook_field_languages() is not documentedhook_field_purge_field- FIXED - #777092: Field purge hooks are not documentedhook_field_purge_instance- FIXED - #777092: Field purge hooks are not documentedhook_field_storage_purge- FIXED - #777098: Field storage purge hooks are not documentedhook_field_storage_purge_field- FIXED - #777098: Field storage purge hooks are not documentedhook_field_storage_purge_instance- FIXED - #777098: Field storage purge hooks are not documentedhook_field_storage_update_field- FIXED - #777100: hook_field_storage_update_field is not documentedhook_field_ui_view_modes_tabs- FIXED - #777102: hook_field_ui_view_modes_tabs() is undocumentedhook_field_update_forbid- FIXED - #775936: hook_field_update_forbid() is undocumentedhook_filetransfer_backends- FIXED - #727282: hook_filetransfer_backends() is undocumentedhook_hook_info_alter- FIXED - #777080: hook_hook_info_alter() is not documentedhook_language_init- Someone fixed this one.hook_language_switch_links_alter- FIXED - #675144: doc header problem in translation_language_switch_links_alter()hook_process- FIXED - #736326: hook_process() and associated hooks are undocumentedhook_preprocess- FIXED - #736326: hook_process() and associated hooks are undocumentedhook_rdf_namespaces- FIXED - #623684: Improve documentation of rdf modulehook_search_page- FIXED - #171317: hook_search_page not appearing on api.drupal.orghook_themes_disabled- FIXED - #491214: implement the top level Appearance / Choose Theme admin pagehook_themes_enabled- FIXED - #491214: implement the top level Appearance / Choose Theme admin pagehook_token_info_alter- FIXED - #673462: Complete API documentation for hook_tokens(), hook_token_info(), hook_token_info_alter() neededhook_trigger_info_alter- FIXED - #776728: hook_trigger_info_alter() is undocumentedhook_updater_info- FIXED - #605270: Document new update manager hookshook_updater_info_alter- FIXED - #605270: Document new update manager hookshook_verify_update_archive- FIXED - #605270: Document new update manager hooksSee also: #675116: field.api.php hook documentation is incomplete - for several hooks that have doc headers but no function bodies.
Comment #6
webchickWow. Thank you for doing this.
Comment #7
jhodgdonYou're welcome!
Two of the above issues have been patched/committed... So there are now "only" 24 hooks above without issues filed, plus 3 filed issues.
12 of the Completely Undocumented are field hooks. Probably someone who knows about the field API should take care of those, as well as #675116: field.api.php hook documentation is incomplete.
7 of the Undocumented are _alter hooks, where the non_alter hook has been documented, so they should be easy.
The other 5 need someone to research what their inputs/outputs are and write the doc. Hopefully the notes in http://drupal.org/files/issues/tofix.txt will at least provide the starting point for research, and hopefully at least one module in core currently implements them so there will be an example.
Anyone who wants to help on this is most welcome! :)
Comment #8
webchickTagging so those working on API documentation fixes can find it.
Comment #9
jhodgdonThose working on API doc issues should see this already, because it's in the documentation component. :) I thought Needs Doc was usually for things needing to go into the module/theme upgrade guides?
Comment #10
webchickGenerally speaking, it is, but tagging it this way makes it really convenient for me to point everyone who wants to help with critical API docs at one tag. It's also related to changes in APIs so I think it's appropriate to re-use the same thing here.
Comment #11
jerdiggity CreditAttribution: jerdiggity commentedAdding issue to this collective list then downgrading the issue's priority as per catch/webchick:
Comment #12
webchickNo, this one is "special" and deserves its own critical status.
Comment #13
Dave ReidYes, this one definitely needs to stay critical.
Comment #14
gddHere's another for the list
#727282: hook_filetransfer_backends() is undocumented
Comment #15
jhodgdonbump!
So all of the hooks at least have issues now (see #5 above). There are still a few that need work or initial patches, but we're getting there -- special thanks to robeano and heyrocker!
Comment #16
catchPer discussion with webchick, moving this to the 'release checklist' (also this one gets us under 99 criticals, we can always move it back later). See http://drupal.org/project/drupal
Comment #17
jhodgdonStatus:
Everything has now been patched, except
#675116: field.api.php hook documentation is incomplete
That issue still needs a considerable amount of work, filling in function bodies for field API hooks.
Comment #19
jhodgdonStatus update:
OPEN: #675116: field.api.php hook documentation is incomplete
There are still several hooks in there that are missing function bodies. It has been proposed as a Google Code-In project (see that issue for details).
NEEDS WORK: #929208: Path hook api docs are missing function bodies
This issue was reported recently, and has a patch that just needs a little tweaking
Comment #20
jhodgdonRemoving redundant tag. Only #675116: field.api.php hook documentation is incomplete is still open on this issue.
Comment #21
figaro CreditAttribution: figaro commentedWas submitted as a google code-in task: http://www.google-melange.com/gci/task/show/google/gci2010/drupal/t12904...
Comment #22
jhodgdonSince we're down to just one issue now, I think it's time to close this issue.