Does anyone ever read the documentation? There's even a dedicated chapter for Zend\Form\View\Helper-Classes, that should answer all your questions.
Furthermore, since you'd probably want the TB3-Style for all your Form Elements, you may be interested in one of the many, many TB-Modules
// Edit
I don't see how the documentation does not answer your question :S I believe the default output of the formRadio()
viewHelper is what you're looking for anyways, so all you need is a separate div, right?
// any.phtml
<?=$this->form()->openTag($form);?>
<div class="radio">
<?=$this->formRadio($form->get('radio1')); ?>
</div>
<?=$this->form()->closeTag();?>
// Edit2
And of course you always have the option of writing your very own formRadio()
ViewHelper that writes out the div
for you. There's an easy to find SO Question, just for this very topic available.
// Edit3
Feeling guilty in attitude, your ViewHelper could be as simple as this:
// Application\Form\View\Helper\FormRadio.php
namespace Application\Form\View\Helper;
use Zend\Form\View\Helper\FormRadio as OriginalFormRadio;
class FormRadio extends OriginalFormRadio
{
protected function renderOptions(/* include original attributes here */)
{
// Include 100% of Original FormMultiCheckbox Code
// https://github.com/zendframework/zf2/blob/master/library/Zend/Form/View/Helper/FormMultiCheckbox.php#L147
// Now change this one line #227 into your code
// Instead of: https://github.com/zendframework/zf2/blob/master/library/Zend/Form/View/Helper/FormMultiCheckbox.php#L227
$template = '<div class="radio">' . $labelOpen . '%s%s' . $labelClose . '</div>';
}
}
Then you gotta overwrite the default ViewHelper
// Inside Module Class
public function getViewHelperConfig()
{
return array(
'invokables' => array(
'formradio' => 'Application\Form\View\Helper\FormRadio'
)
);
}
Additional Information: In this example i overwrite the original formRadio, rather than formMultiCheckbox. This is because I imagine TB3 would have a different CSS Class for rendering Checkboxes and not Radio elements.