Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
API page: http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...
Describe the problem you have found:
I can't make sense of this paragraph describing how hook_menu() works:
Note that if a page or theme callback function has an argument list array, these arguments will be passed first to the function, followed by any any arguments generated by optional path arguments as described above.
Not sure what these phrases are supposed to mean or refer to:
- "has an argument list array"
- "passed first to the function"
- "any any"
- "as described above"
Bottom line, I don't know what this paragraph is supposed to convey. Rewording this and adding a very short example would help.
Comment | File | Size | Author |
---|---|---|---|
#5 | 1182970-menu-optional-args.patch | 1.75 KB | mr.baileys |
#3 | 1182970-menu-optional-args.patch | 1.82 KB | mr.baileys |
#2 | 1182970-menu-optional-args.patch | 1.44 KB | mr.baileys |
Comments
Comment #1
jhodgdonI see your confusion.
What it's trying to say is that if you have something like this:
And you visit path abc/def/ghi/jkl
the function mymodule_abc_view() will get arguments: 'def', 'foo' [from the 'page arguments'], followed by 'ghi', 'jkl' [from the additional path components, as described above that paragraph].
Agreed that this paragraph needs a rewrite, possibly with this example, to make it clearer.
Comment #2
mr.baileysHere's a suggested fix.
Comment #3
mr.baileysPrevious patch was incomplete...
Comment #5
mr.baileysLooks like my local copy was outdated, re-rolled against a fresh copy...
Comment #6
jhodgdonI like it! A good concrete example is worth a thousand explanations, to paraphrase the usual picture's value statement.
8.x/7.x please... and then this is probably also worth porting to 6.x, don't you think? Works the same there. If we port to 6.x, we have to move this to the Documentation project, component "api doc files", and mark "patch/to be ported" -- the hook docs are there for 6.x.
Comment #7
webchickCommitted to 8.x and 7.x. Thanks!
Comment #8
jhodgdonSince the D6 port is in the Documentation project, I filed it as a separate issue. I didn't want to move this one out of Drupal core.
#1201380: hook_menu doc has some confusing text in it