Link in form label using route
symfony
Solution
The best way is to overwrite the twig block used to render that specific label.
First, check the form fragment naming section of the docs. Then create a new block in your form template with the the appropriate name. Don't forget to tell twig to use it:
{% form_theme form _self %}
For the next step check the default `form_label` block.
You'll probably only need a portion of it, something like this (I'm leaving the default block name here):
{% block form_label %}
{% spaceless %}
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
<a href="{{ path("route_for_terms") }}">{{ label|trans({}, translation_domain) }}</a>
</label>
{% endspaceless %}
{% endblock %}
Problem
In my registration form i have a checkbox "I accept the terms", and want to link the word "terms" to my terms page. Is there a way to add a link to a form label, using a route? (preferably without injecting the container in the form)