Forked from marijn/terms-and-conditions-in-label.twig
Created
February 10, 2017 13:55
-
-
Save sdieunidou/0f6b2254a26624ebbe1d19539b9e5691 to your computer and use it in GitHub Desktop.
This is how you add a link to a label with Symfony forms, sort of. Cause you'll have a label tag twice...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set terms_link %}<a title="{% trans %}Read the General Terms and Conditions{% endtrans %}" href="{{ path('get_general_terms_and_conditions') }}">{% trans %}General Terms and Conditions{% endtrans %}</a>{% endset %} | |
{% set general_terms_and_conditions %}{{ 'I have read and accept the %general_terms_and_conditions%.'|trans({ '%general_terms_and_conditions%': terms_link })|raw }}{% endset %} | |
<div> | |
{{ form_errors(form.acceptGeneralTermsAndConditions) }} | |
{{ form_widget(form.acceptGeneralTermsAndConditions) }} | |
<label for="{{ form.acceptGeneralTermsAndConditions.vars.id }}">{{ general_terms_and_conditions|raw }}</label> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment