From 1170b7090e34bb71ee982e5b70646bef0e33e6fb Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 2 May 2019 09:37:07 +0200 Subject: [PATCH] Add label_raw attribute to form theme --- .../views/Form/form_div_layout.html.twig | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index d641e89221c2c..1e995617c6c9c 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -232,7 +232,16 @@ {% set label = name|humanize %} {%- endif -%} {%- endif -%} - + {%- if translation_domain is not same as(false) -%} + {%- set label = label|trans(label_translation_parameters, translation_domain) -%} + {%- endif -%} + {%- endblock button_widget -%} {%- block submit_widget -%} @@ -275,11 +284,14 @@ {% set label = name|humanize %} {%- endif -%} {%- endif -%} + {%- if translation_domain is not same as(false) -%} + {%- set label = label|trans(label_translation_parameters, translation_domain) -%} + {%- endif -%} <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}> - {%- if translation_domain is same as(false) -%} - {{- label -}} + {%- if label_raw|default(false) -%} + {{- label|raw -}} {%- else -%} - {{- label|trans(label_translation_parameters, translation_domain) -}} + {{- label -}} {%- endif -%} {%- endif -%}