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.

Comments

webchick’s picture

Priority: Normal » Critical

That would be critical. Thanks for the report.

Nick Lewis’s picture

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.

Nick Lewis’s picture

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)

dvessel’s picture

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.

webchick’s picture

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!

oadaeh’s picture

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

nancydru’s picture

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

Hook_submit is still documented even though it is gone.

Anonymous’s picture

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

nancydru’s picture

Title: *Nine* undocumented hooks in Drupal 6 » *Twenty One* undocumented hooks in Drupal 6

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

nancydru’s picture

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.

nancydru’s picture

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

webchick’s picture

Yep, you did it right. :) I don't know if docs exist, but you basically make changes and commit it, like any other file.

nancydru’s picture

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?

webchick’s picture

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

nancydru’s picture

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

webchick’s picture

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.

sepeck’s picture

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

nancydru’s picture

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

Island Usurper’s picture

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

nancydru’s picture

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

webchick’s picture

I'm handling hook_theme_registry_alter() at http://drupal.org/node/259116. Eyeballs appreciated.

webchick’s picture

Title: *Twenty One* undocumented hooks in Drupal 6 » *Nine* undocumented hooks in Drupal 6

Fixing title. hook_theme_registry_alter() is now documented, although merlin is helping me tweak the final bits.

webchick’s picture

Title: *Twenty One* undocumented hooks in Drupal 6 » *Nine* undocumented hooks in Drupal 6
Status: Active » Fixed

Ok, going through Nancy's latest list, there were actually only two of those that are hooks: hook_actions_delete() and hook_locale().

The rest are ones called with module_invoke('something', 'something') which is NOT the same as a hook. That's basically a "safe" way to call a function like taxonomy_form_all() if you don't know if taxonomy module is going to be there for sure or not. Confusing, I know.

Anyway, I committed some boilerplate text for both of these hooks to serve as at least documentation that they exist. hook_actions_delete() is pretty straight-forward, but I have no idea what hook_locale() is supposed to do. I've re-opened the locale issue @ #139970: The big locale cleanup (and adding text domain functionality) in the hopes that one of the folks who worked on that will spruce up the docs.

In the meantime, I'm marking this fixed. FINALLY. Hooray.

webchick’s picture

Status: Fixed » Active

BLAH. spoke too soon. I grepped for drupal_alter and re-grepped for module_invoke_all found some more:

hook_action_info #148410: Actions in core
hook_action_info_alter #148410: Actions in core
hook_openid #131026: OpenID Consumer/Relying Party support in core for 6.x
hook_translation_link_alter #141996: Language switcher block
hook_system_info_alter #141727: Regression: Allow maintenance to be themable
hook_update_status_alter #94154: update.module in core (formerly known as update_status) (granted, this basically only exists for update_advanced.module's use but still...)

And hook_locale #139970: The big locale cleanup (and adding text domain functionality)

webchick’s picture

As a new strategy, I went through CVS annotate and re-opened all of the issues that originally committed these patches without documentation, in the hopes that the people who made the changes in the first place will do so.

We'll see. ;P Anyway, I've spent enough time for one weekend screwing with this.

nancydru’s picture

Thanks, Angie.

webchick’s picture

Title: *Nine* undocumented hooks in Drupal 6 » *Seven* undocumented hooks in Drupal 6
pwolanin’s picture

StatusFileSize
new1.57 KB

committed this initial doc for hook_system_info_alter to the HEAD and DRUPAL-6--1 developer docs.

drewish’s picture

StatusFileSize
new5 KB

I'm committing the attached that backs out NancyDru's addition of hook_get_vocabularies(), hook_get_tree() and hook_get_parents(). As webchick pointed out in #23 those aren't really hooks.

nancydru’s picture

I wondered about that, but they were on the list. I've also seen people using module_invoke to call them.

Barry Madore’s picture

Project: Documentation » Drupal core
Version: » 7.x-dev
Component: Documentation in CVS » documentation
pwolanin’s picture

StatusFileSize
new2.78 KB

Committing attached starting docs for hook_action_info() and hook_actions_info_alter(). How frustrating...

lilou’s picture

Title: *Seven* undocumented hooks in Drupal 6 » *Five* undocumented hooks
drewish’s picture

Title: *Five* undocumented hooks » *Two* undocumented hooks

Looking at webchick's list on #24 and then comparing it to api.dupal.org it looks like the current list really only:

  1. hook_openid #131026: OpenID Consumer/Relying Party support in core for 6.x
  2. hook_translation_link_alter #141996: Language switcher block

I closed all the other issues.

lilou’s picture

dave reid’s picture

hook_translation_link_alter is being addressed in #344661: Document hook_translation_link_alter. Please review.

dave reid’s picture

Title: *Two* undocumented hooks » *ONE* undocumented hook

We're down to ONE!

toddy’s picture

I've just filed #345157: Fix @link syntax in documentation for hook_update_last_removed(). Was this the last undocumented hook?

dave reid’s picture

It's actually hook_openid. See #345376: Document missing hook_openid().

dave reid’s picture

dave reid’s picture

Added #364564: Undocumented hook_ranking in search.api.php to the list of undocumented hooks in #40.

rfay’s picture

Title: *THREE* undocumented hooks » Document undocumented hooks (currently 3 on list)
Assigned: Unassigned » rfay
rfay’s picture

Title: Document undocumented hooks (currently 3 on list) » Document undocumented hooks (currently 1 remaining on list)

As far as I can tell, the first two of these 3 are taken care of. I'll look at #364564: Undocumented hook_ranking in search.api.php,

but #345376: Document missing hook_openid() and #349469: Document missing hook_node_view_alter() are dead issues.

rfay’s picture

Status: Active » Fixed

#364564: Undocumented hook_ranking in search.api.php is now marked as RTBC, so I'll mark this one fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.