Is it possible to access $form['#parameters'] from within the php snippet that dynamically populates a dropdown list?

Here is the $form:

Array
(
  ...
   [#parameters] => Array
        (
            [0] => mytype_node_form
            [1] => Array
                (
                    [type] => mytype
                    [language] => Spanish
                )

        )
)

And here is the code snippet for dynamically populating the dropdown (pasted into the "php" section of the options widget):

global $user;
$uid = $user->uid;
// $language = $form['#parameters'][1]['language']; // pass language as parameter
$language = 'spanish';
$allowed_values = _mymodule_get_allowed_values($uid,$language);
return ($allowed_values);

If I hard-code the language ($language = 'spanish';) then this works fine.
But if I try to grab the language from $form['#parameters'][1]['language'], it does not work.
It seems $form is not defined.

Question #1
Is it possible to access the form parameters, from within the php code snippet that defines the allowed-values list?
Question #2
Rather than pasting the php snippet into the 'php' section of the options widget, is it possible to specify the allowed-values list from inside hook_form_alter, or one of the other hooks?

Thanks very much,
Mindy

Comments

karens’s picture

Status: Active » Closed (won't fix)

Closing old issues. None of us is using the D5 version any more, so hard to provide any support. Sorry.