OK so i have a choice form with 2 options
$builder->add('type', 'choice', array(
'label' => 'User type',
'choices' => array('1' => 'Customer', '2' => 'Supplier'),
'expanded' => true,
'multiple' => false,
'required' => false,
));
And i want to split options in view using twig to get something like this:
{{ form_widget(form.type/choice_1/) }}
some html stuf
{{ form_widget(form.type/choice_2/) }}
Any sugestions?
You need to add template to the form. Here’s the docs:
http://symfony.com/doc/current/cookbook/form/form_customization.html
Here you got multiple examples:
https://github.com/phiamo/MopaBootstrapBundle/blob/master/Resources/views/Form/fields.html.twig
This field is for you:
You can do whatever you want just leave the:
{{ form_widget(child, {'attr': {'class': attr.widget_class|default('')}}) }}alone 🙂YourBundle/Resources/Form/fields.html.twig{% form_theme form 'AcmeDemoBundle:Form:fields.html.twig' %}