Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
menu system
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
16 Oct 2007 at 21:00 UTC
Updated:
26 Nov 2007 at 22:43 UTC
Jump to comment: Most recent file
The menu's ability to load arguments based upon keywords in the menu is not enough for abstract modules like Views; these keywords translate directly to function names, but Views cannot be expected to create a specialized function for every variant of every argument it may provide. That is highly unwieldy.
However, it is fairly simple to add arguments.
This also adds a special argument, '%index', because Views also needs to know *which* argument it is, in case there is more than one.
This is simplest solution I could come up with; there are likely more, but this is Very Important.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | menu_load_arguments-184022-2.patch | 2.54 KB | chx |
| #1 | menu-context_0.patch | 2.54 KB | merlinofchaos |
| menu-context.patch | 1.68 KB | merlinofchaos |
Comments
Comment #1
merlinofchaos commentedNote: chx wrote the bulk of this patch, and I forgot to credit him on my initial posting. I added the %index stuff.
At his request, I also just added %map which will solve http://drupal.org/node/177488 as well, which currently has a similar patch in it but I think this one will work out better.
This reroll also includes more comments.
Comment #2
chx commentedChristmas came early with %map -- it's solely merlinofchaos' invention. What a nice solution! Yes I have written some of this and I am fixing a typo in here but otherwise, it works and works well and does nto break anything existing and it's commented nicely.
Comment #3
chx commentedComment #4
pwolanin commenteda quick look - seems reasonable, though I'm rather unclear on when you'd use %index
Comment #5
merlinofchaos commentedViews would use %index when it has multiple args embedded in the URL and it needs to match them up to the actual argument.
Take the simple URL of: view/%/%
My view might have the first one as a node object and the second one as a quatloo object (something clearly defined by a module extension and is nothing known to any of our installations) and views is able to direct traffic so that it gets identified properly...but if and only if it can tell one argument from the other. Since this patch only has a single 'load arguments' line, which is sufficient for 99.9% of the URLs out there, that's fine, but a little extra %index makes it work in the expanded case.
Comment #6
pwolanin commentedah, I hadn't read the patch in enough detail, it's starting to make sense now.
I'm not sure whether to love or hate this bit:
Comment #7
gábor hojtsyDiscussed this with chx, brainstormed some documentation fixes and committed. Unfortunately I cannot think of better then naming this $function, as most of the time this indeed will be a function name. $callback would not be of any improvement here IMHO.
Comment #8
(not verified) commentedComment #9
profix898 commentedIs there any documentation available for this? Or any example code? I cant seem to get this implemented ...