Hello everybody,

I have a problem to customize form field in twig. It's easy to add 
attributes to a field form with for 
instance form_field(contactForm.function, {'class': 'w-small', 'rows': 
'3'}), put it seems there is no way to do the same with errors and labels. 
When I look a bit further 
in Symfony/Bundle/TwigBundle/Extension/FormExtension.php there is an 
attributes array in renderField but nothing similar in renderErrors and 
renderLabel, when I look as well 
in Symfony/Bundle/TwigBundle/Resources/views/form.html.twig in label block 
for instance there is no variable which permit to add an attribute easily.

The solution I found was to override form.html.twig, but it's a bit tricky 
only for adding a class.

So I wanted to know if I misunderstood how to add an attribute or is there 
any lack in code ?

Thanks for yours answers

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to