Drupal 7: How to set values (allowed_values) for field (select) dynamically (from module)?
Hi, I now about hook_form_alter() for modification form elements, but i have bad feeling use arrays like: $form['profile_main']['field_year_of_graduation'][LANGUAGE_NONE][0] I think sometimes can be LANGUAGE_NONE index changed and then my code not work. Is there better way for set allowed_values dynamically or i need create my custom field? Havran -- Juraj Chlebec aka Havran http://www.svoji.sk
to populate options in select list, you can call a function in the cck / fieldapi UI and that function do all the trick. I believe this can be done without form alter. On Fri, Jun 29, 2012 at 9:59 PM, Juraj Chlebec <havran@gmail.com> wrote:
Hi,
I now about hook_form_alter() for modification form elements, but i have bad feeling use arrays like:
$form['profile_main']['field_year_of_graduation'][LANGUAGE_NONE][0]
I think sometimes can be LANGUAGE_NONE index changed and then my code not work.
Is there better way for set allowed_values dynamically or i need create my custom field?
Havran
-- Juraj Chlebec aka Havran http://www.svoji.sk
-- [ Drupal support list | http://lists.drupal.org/ ]
-- Regards, Vaibhav Jain
participants (2)
-
Juraj Chlebec -
Vaibhav Jain