[development] The new menu system
Derek Wright
drupal at dwwright.net
Thu Sep 28 16:00:38 UTC 2006
On Sep 27, 2006, at 12:35 AM, Dries Buytaert wrote:
> Any particular reason not to use %d and %s?
for example, a large # of the menu items registered in the project
module and friends require an argument to specify which project
you're operating on, but that could be either numeric (project node
id) or a string (the project's short name). in most cases, the
project id is currently the last element of the URL, so it's not
registered as part of the menu path anyway, but i could certainly
imagine a situation where i'd need the arg in the middle of the URL
with additional path elements at the end (especially in some of the
schemes i've thought of to try to solve http://drupal.org/node/
66981). assuming i need some menu items like:
project/[id]/[function]
where [function] is a string describing the action this page will
perform, and [id] is either an int (project nid) or string (project
name), why should i have to register this as 2 separate menu items
(one with a %d and the other with a %s)? they're both going to be
identical in every other respect, and unless i'm insane, the callback
function for both items will be a single function that just checks
"is_numeric(arg(1))" and does the right thing depending on what kind
of argument it is.
just providing a potential use-case for a generic % in the menu path
-- i'm not set on it (i've got more important holy wars to wage). ;)
thanks,
-derek
More information about the development
mailing list