I'm working on a module with a page callback that will parse a bunch of optional arguments. I know that optional arguments are passed on (as described in the hook_menu documentation), but short of defining an endless list of variables in the callback function like

function mymodule_abc_view($a = '', $b = '', $c = '', $d = '') {
...

is there a way to pass all the arguments on as an array for example?

Comments

steffenr’s picture

You could split the arguments with a custom operator like "+" for example.. In this case you could use the php explode function to get all the arguments..

http://www.example.com/mymenu/arg1+arg2+arg3+arg4+arg5+arg6+arg7+....

function mymodule_abc_view($a = '') {
$args = explode('+',$a);

SteffenR

Whiskey’s picture

Nice and simple, thanks, now why didn't I think of that ;)
Suppose the url would look a bit nicer if formatted with slashes, but that is not that big of a deal.