Hi!
I already read the handbook pages about 4.7's new form api, but I still dont understand how to use it
correctly. I wrote a simple test module to play with the api:
function formtest_settings() {
$form['global'] = array(
'#type' => 'fieldset',
'#title' => t('form_group'),
);
$form['global']['formtest_enable'] = array(
'#type' => 'radios',
'#title' => t('Test Radios'),
'#default_value' => variable_get('formtest_enable', 0),
'#options' => array(t('Off'), t('On')),
);
$options = array();
$options[0] = "Choose Option";
$options[1] = "Option A";
$options[2] = "Option B";
$form['global']['formtest_method'] = array(
'#type' => 'select',
'#title' => t('Test Select'),
'#default_value' => 1,
'#options' => $options,
'#description' => t('Sample Desciption'),
);
//$output = form_render($form);
//$output = drupal_get_form('testform', $form);
//return $output;
return $form;
}
The code works nicely with return $form, but when I try one of the other lines and return $output
I receive "Fatal error: Cannot use string offset as an array in ...\system.module on line 728"
Whats wrong with my code? What function should I use form_render or drupal_get_form?
As long I must use return $form, I'm unable to apply special format to my output,
e.g. $output = theme('table', $header, $rows) is not possible then.
Hoping for help, Thilo