Symfony2: custom HTML inside label
Is there a way with Symfony 2 forms to add HTML inside a label?
I want to:
<label for="myfield"><span class="photo">My label</span></label>
How can i write None of these ideas work properly:
<span class="photo">{{ form_label(form.myfield) }}</span>
or
{{ form_label(form.myfield, '<span class="photo">'~myfield~'</span>') }}
Thanks for your help, A
+5
2 answers
Take a look at the Symfony2 Form documentation , especially the “ Add” Required Asterisk to Field Label section .
I'm not sure if this is the best way to go, but it should work.
+5