Skip to content

Commit e088d76

Browse files
committed
minor symfony#61726 [TwigBridge] Call form_label_content block inside button_widget block (ker0x)
This PR was merged into the 7.4 branch. Discussion ---------- [TwigBridge] Call `form_label_content` block inside `button_widget` block | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Refactor of block `button_widget` to call block `form_label_content`, introduce in Symfony `6.2`, to render the label of the button. Commits ------- 66aea71 [TwigBridge] Call form_label_content block inside button_widget block
2 parents 3f60ead + 66aea71 commit e088d76

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

src/Symfony/Bridge/Twig/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Add `access_decision()` and `access_decision_for_user()` Twig functions
8+
* Call `form_label_content` inside `button_widget` block to render button label
89

910
7.3
1011
---

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -226,30 +226,8 @@
226226
{%- endblock range_widget %}
227227

228228
{%- block button_widget -%}
229-
{%- if not label -%}
230-
{%- if label_format is not empty -%}
231-
{% set label = label_format|replace({
232-
'%name%': name,
233-
'%id%': id,
234-
}) %}
235-
{%- elseif label is not same as(false) -%}
236-
{% set label = name|humanize %}
237-
{%- endif -%}
238-
{%- endif -%}
239229
<button type="{{ type|default('button') }}" {{ block('button_attributes') }}>
240-
{%- if translation_domain is same as(false) -%}
241-
{%- if label_html is same as(false) -%}
242-
{{- label -}}
243-
{%- else -%}
244-
{{- label|raw -}}
245-
{%- endif -%}
246-
{%- else -%}
247-
{%- if label_html is same as(false) -%}
248-
{{- label|trans(label_translation_parameters, translation_domain) -}}
249-
{%- else -%}
250-
{{- label|trans(label_translation_parameters, translation_domain)|raw -}}
251-
{%- endif -%}
252-
{%- endif -%}
230+
{{- block('form_label_content') -}}
253231
</button>
254232
{%- endblock button_widget -%}
255233

0 commit comments

Comments
 (0)