I am a bit confused. I have created a simple form with a one text box and a submit button. Now I want to add a select/option dropdown box of taxonomy terms, using the taxonomy_get_vocabularies() function.
$vocabularies = taxonomy_get_vocabularies('my_type');
My question is how do I get vocabulary list onto form "the Drupal way". The way Drupal defines form seem quite rigid. Also how could I make this conditionl, say on existence of relevant taxonomy terms.
function my_form_name($form_state) {
// A Short question.
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Question'),
'#default_value' => $node->title,
'#required' => TRUE,
'#weight' => 1,
'#description' => t('A text box goes here '),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('submit'),
'#weight' => 7,
);
return $form;