0

I haven't found a solution for the problem yet. I assume that I can do it through Twig, but I don't know how. I'll be thankful for help.

Razip
  • 155
  • 1
  • 12
  • 1
    possible duplicate of [How to set a class attribute to a Symfony2 form input](http://stackoverflow.com/questions/6734821/how-to-set-a-class-attribute-to-a-symfony2-form-input) – A.L Nov 30 '14 at 22:44
  • I haven't meant a form field. – Razip Dec 01 '14 at 05:48

1 Answers1

1

When you render a widget, you can add class with name foo, like this:

{{ form_widget(form.name, {'attr': {'class': 'foo'}}) }}

If you want to add class foo to form element (tag), then you can use the same syntax:

{{ form(form, { 'attr': {'class': 'foo'} }) }}

Check out official documentation.

repincln
  • 2,029
  • 5
  • 24
  • 34