Skip to content

Commit 7e56765

Browse files
committed
minor #47732 [TwigBridge] Adding the new block form_label_content for bootstrap 5 layout (Yoann-TYT)
This PR was merged into the 6.2 branch. Discussion ---------- [TwigBridge] Adding the new block form_label_content for bootstrap 5 layout | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Adding the new block `form_label_content` for `bootstrap_5_layout.html.twig` to simplify it Linked to [[TwigBridge] Add form_label_content and form_help_content block to form_div_layout](symfony/symfony#45985) Commits ------- c2b9becda4 adding the new block form_label_content for bootstrap_5_layout.html.twig to simplify it
2 parents 082b286 + 6a88aaf commit 7e56765

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

Resources/views/Form/bootstrap_5_layout.html.twig

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -308,33 +308,11 @@
308308
{%- if parent_label_class is defined -%}
309309
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) -%}
310310
{%- endif -%}
311-
{%- if label is not same as(false) and label is empty -%}
312-
{%- if label_format is not empty -%}
313-
{%- set label = label_format|replace({
314-
'%name%': name,
315-
'%id%': id,
316-
}) -%}
317-
{%- else -%}
318-
{%- set label = name|humanize -%}
319-
{%- endif -%}
320-
{%- endif -%}
321311

322312
{{ widget|raw }}
323313
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
324314
{%- if label is not same as(false) -%}
325-
{%- if translation_domain is same as(false) -%}
326-
{%- if label_html is same as(false) -%}
327-
{{- label -}}
328-
{%- else -%}
329-
{{- label|raw -}}
330-
{%- endif -%}
331-
{%- else -%}
332-
{%- if label_html is same as(false) -%}
333-
{{- label|trans(label_translation_parameters, translation_domain) -}}
334-
{%- else -%}
335-
{{- label|trans(label_translation_parameters, translation_domain)|raw -}}
336-
{%- endif -%}
337-
{%- endif -%}
315+
{{- block('form_label_content') -}}
338316
{%- endif -%}
339317
</label>
340318
{%- endif -%}

0 commit comments

Comments
 (0)