I'm trying to use field_template and multi_field_template to format a form and having trouble formatting checkboxes and radio buttons. Specifically I can't get both the form label ("Countries") and the text associated with the checkboxes or radio buttons ("US", "Canada", "Mexico") to print.
For example, I want something like (attempt to simulate radio buttons):
<b>Countries:</b> o US o Canada o Mexico
Simplified Fieldset code looks like:
<code>
$form_test = Fieldset::factory('form_test');
$form_test->add('radio_id', 'Radio', array(
'type' => 'radio',
'options' => array('us' => 'US', 'can' => 'Canada', 'mex' => 'Mexico'),
'id' => 'radio_test',
), array(
array('required')
));
$form_test->add('submit', null, array(
'type' => 'submit',
'value' => 'Submit'
));
</code>
I've gone through the function field_template() in form.php, and checkboxes and radio buttons generate $build_field as an array. If preg_match() on line 725 is true, then the checkboxes/radio buttons get text associated with them, but line 739 returns $template before the remaining code can build the text for the main label.
Any help would be appreciated.