Is there a way with Symfony 2 forms to add HTML inside a label?
I want:
<label for="myfield"><span class="photo">My label</span></label>
How can I write it? None of these ideas work properly as expected:
<span class="photo">{{ form_label(form.myfield) }}</span>
Or
{{ form_label(form.myfield, '<span class="photo">'~myfield~'</span>') }}
Thanks for your help, A
Take a look to Symfony2 Form theming documentation, especially to the "Adding a "Required" Asterisk to Field Labels" section.
I am not sure this is the best way to go, but it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With