Skip to main content
Remove tag from title
Source Link
Pierre.Vriens
  • 36k
  • 40
  • 51
  • 183

Best practice for Drupal 7 language key for "und" in hook_form_alter

I'm modifying in a form in my custom module. Code looks like:

function my_module_form_alter(&$form, &$form_state, $form_id) { if ($form_id == "someID") { $form['field_charity_author']['und'][0]['value']['#value'] = arg(3); //$form['field_charity_author']['#type'] = 'hidden'; } } 

However, I think hard-coding und is bad. What should be the proper way to modify form fields properly in this case?

Thanks.

Best practice for Drupal 7 language key for "und" in hook_form_alter

I'm modifying in a form in my custom module. Code looks like:

function my_module_form_alter(&$form, &$form_state, $form_id) { if ($form_id == "someID") { $form['field_charity_author']['und'][0]['value']['#value'] = arg(3); //$form['field_charity_author']['#type'] = 'hidden'; } } 

However, I think hard-coding und is bad. What should be the proper way to modify form fields properly in this case?

Thanks.

Best practice for language key for "und" in hook_form_alter

I'm modifying in a form in my custom module. Code looks like:

function my_module_form_alter(&$form, &$form_state, $form_id) { if ($form_id == "someID") { $form['field_charity_author']['und'][0]['value']['#value'] = arg(3); //$form['field_charity_author']['#type'] = 'hidden'; } } 

However, I think hard-coding und is bad. What should be the proper way to modify form fields properly in this case?

Added tag "multilingual" for better categorizing this question.
Link
kalabro
  • 8k
  • 36
  • 46
edited tags
Link
avpaderno
  • 98.1k
  • 15
  • 165
  • 284
edited tags
Link
googletorp
  • 35.4k
  • 10
  • 70
  • 109
Loading
Tweeted twitter.com/#!/StackDrupal/status/181437585774751747
Source Link
Shafiul
  • 1.2k
  • 6
  • 30
  • 40
Loading