[support] Simple Module Coding Question
Metzler, David
metzlerd at evergreen.edu
Wed Jul 30 18:47:43 UTC 2008
Thanks for this guys I really didn't realize this was possible. When I
read the module porting guidelines, it suggested that form rendering
functions now only take one parameter, that is formid. I wish I knew
about this before I wrote all those static caching functions as a
workaround. :).
FYI: If you do the exact code Ivan suggests here this, you need to
make sure it's in the (!$maycache) section of the hook_menu, which means
of course you can't customize it. This will be better in D6 where
wildcards take up the slack.
Dave
-----Original Message-----
From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On
Behalf Of Ivan Sergio Borgonovo
Sent: Wednesday, July 30, 2008 11:41 AM
To: support at drupal.org
Subject: Re: [support] Simple Module Coding Question
On Wed, 30 Jul 2008 11:07:43 -0700
"Metzler, David" <metzlerd at evergreen.edu> wrote:
> I usually just get it using a call to arg(1) in the from rendering
> function.
>
> Make sense?
This makes your form definition function dependent on where it is
rendered.
What about
...
'path' => 'somepath/'.arg(1).'/'.arg(2),
'callback' => 'drupal_get_form',
'callback arguments' => Array('my_form',arg(1), arg(2)), ...
function my_form($p1, $p2, $form_values) {
$form['bau']=array(...);
}
I just had issues with multistep forms making use of $form_values when I
was willing to provide a fall back from somepath/1/2 to somepath/
without duplicating too much code.
I solved it in a way that I didn't find intuitive but I forgot how I
did.
But in less complicated situation it definitively works smoothly in D5.
--
Ivan Sergio Borgonovo
http://www.webthatworks.it
--
[ Drupal support list | http://lists.drupal.org/ ]
More information about the support
mailing list