Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Jan 2012 at 13:57 UTC
Updated:
10 Jul 2012 at 15:28 UTC
Jump to comment: Most recent file
Comments
Comment #1
jhodgdonThat statement is correct -- I found it documented somewhere recently when I ran into the same issue -- let's see... well I don't know where. But I agree it should be added to the hook_menu() documentation.
Sounds like a good Novice project.
Comment #2
joachim commentedI tested it today as I was building a module that used a menu loader and trying to figure out how to magically get a 404 for an invalid loader ID :)
Comment #3
jhodgdonSame thing I ran into last week. :)
Comment #4
mkadin commentedAs a young drupal novice, I'd be willing to fix this up in the docs...how do I edit them / submit a patch?
Comment #5
jhodgdonSee:
http://drupal.org/novice (novice guide to patching in general)
http://drupal.org/node/144223 (guide to fixing API documentation specifically)
Thanks!
Comment #6
jhodgdonAlso:
http://drupal.org/core-office-hours - a "drop-in" time on IRC where you can get help contributing patches for Drupal Core
Comment #7
mkadin commentedHere's a patch. First time writing documentation. Thoughts? I'll backport it afterwards if folks like the explanation.
Comment #8
jhodgdonThat's a great start, thanks! I have a few suggestions on your prose:
a) Above in this documentation, the load function is called a 'load function' (without the quotes) rather than an '"auto-loader" function' (with quotes). We should be consistent.
b) The style is a bit conversational... "Take the..." -- maybe it would be better to just say "For example, the node_load() load function for the 'node/%node/edit' path returns FALSE..." ?
c) Rather than saying "nid", please use "ID" or "node ID" in documentation.
d) hook_menu is not what returns the 404 error -- hook_menu() is just a hook that modules can implement. Probably it would be best to say "The menu routing system will then return a 404 error." (I don't think we need to explain that a 404 error means page not found -- that's pretty common knowledge amongst people who would be reading hook_menu() documentation).
e) For future reference, whenever you refer to a function in documentation, be sure to put () after it, so that when the doc is displayed on api.drupal.org, it will turn into a link to that function.
Comment #9
mkadin commentedThanks for the feedback, I'll get right on it.
I got the "auto-loader" terminology from a few blocks of text up the docs...
"Registered paths may also contain special "auto-loader" wildcard components
in the form of '%mymodule_abc', where the '%' part means that this path
component is a wildcard, and the 'mymodule_abc' part defines the prefix for a
load function, which here would be named mymodule_abc_load()."
Should I change the existing "auto-loader" use? Keep what I got? Change mine, leave the existing?
Comment #10
jhodgdonRight. It says '"auto-loader" widcard components' once to refer to the %node types of things in paths, and then it refers to the *functions* as "load function" for the rest of the paragraph. Correct?
Comment #11
mkadin commentedYup that's right. I've changed the text around. Here's a new patch:
Comment #12
jhodgdonExcellent, thanks!
Comment #13
webchickCommitted and pushed to 8.x and 7.x. Thanks, mkadin! :)
Moving down to 6.x.
Comment #14
albert volkman commentedHere's a D6 backport for the documentation project.
Comment #15
jhodgdonThanks! I've committed this to D6. Ignore any test failures above (Documentation project git repository not Drupal Core).
Comment #17
miaoulafrite commentedHello there!
nice thread
i'm currently in the situation where i use this "auto-loader" and i would like to define a callbck function instead of this 404 when node id does not exist
can you please point me some directions on how to?
Comment #18
jhodgdonIt looks like you need some programming support. I'm sorry, but this is a Drupal Core bug report (which has been closed)... And we don't really handle support requests in the Drupal Core issue queue as a regular practice.
There are several support options listed if you click on "Support" at the top of Drupal.org, which will take you to:
http://drupal.org/support
There you can find out about the Drupal IRC channels, and the Forums, which are our two main support mechanisms in the Drupal community.
Good luck with your issue!