I’d like to render a symfony form this way:

My problem concerns the radio buttons widget: I don’t know how to render each choice individually, in order to display other fields between those radio buttons.
Is there a way to achieve this with symfony forms?
Thanks!
Symfony makes this a little difficult to do. You’d like a
renderChoice( $value)method that’s callable from the view, but that would require changing or extending sfFormField.Changing it isn’t future proof, and extending it would also require you to change some symfony variable so the fields accessible in your view are instances of this new class. I don’t know if that option exists.
Instead, I opted to extend sfWidgetFormSelectRadio into the following very simple class which extends
formatChoices. It will check if you’re asking for only one option. If you are, it renders that tag and returns it, otherwise it renders normally viaparent::.This lets you call from your view:
$form['field']->render(array('only_choice'=> $value))where
$valueis the index of the radio option you want to render:Awkward code, but easy enough to use in practice and it won’t break in the future.