Set attributes of the widget container dynamically
I am busy with my form templates inside Symfony 2.0.
You can add attributes to the form field as follows:
$form->add('name', 'text', array('attr' => array('class' => 'my_class')));
But how can I dynamically add attributes to the form widget? If I look at the content of form_div_layout.html.twig it is
{{ block('widget_container_attributes') }}
which can load attributes, but I have no idea where I can add attributes to my FormBuilder in the controller. Can anyone help me?
thank!
+3
source to share