Skip to content

Commit 125727b

Browse files
Merge branch '5.2' into 5.3
* 5.2: [Cache] clarify RedisStore::evaluate() [Messenger] Fixed BC layer for RedeliveryStamp [DoctrineBridge] fix setting default mapping type to attribute/annotation on php 8/7 respectively do not render the same label id attribute twice make AbstractDataCollector extend DataCollector to reduce boilerplate
2 parents 090868a + 64485aa commit 125727b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
{% if app is defined and app.request is defined %}{%- set input_lang = app.request.locale -%}{%- endif -%}
126126
{%- set attr = {lang: input_lang} | merge(attr) -%}
127127
{{- block('form_widget_simple') -}}
128-
{%- set label_attr = label_attr|merge({ class: (label_attr.class|default('') ~ ' custom-file-label')|trim }) -%}
128+
{%- set label_attr = label_attr|merge({ class: (label_attr.class|default('') ~ ' custom-file-label')|trim })|filter((value, key) => key != 'id') -%}
129129
<label for="{{ form.vars.id }}" {% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
130130
{%- if attr.placeholder is defined and attr.placeholder is not none -%}
131131
{{- translation_domain is same as(false) ? attr.placeholder : attr.placeholder|trans({}, translation_domain) -}}

Tests/Extension/AbstractBootstrap4LayoutTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,24 @@ public function testFile()
11211121
);
11221122
}
11231123

1124+
public function testFileLabelIdNotDuplicated()
1125+
{
1126+
$form = $this->factory->createNamed('name', FileType::class);
1127+
1128+
$this->assertWidgetMatchesXpath($form->createView(), ['id' => 'n/a', 'attr' => ['class' => 'my&class form-control-file'], 'label_attr' => ['id' => 'label-id']],
1129+
'/div
1130+
[@class="custom-file"]
1131+
[
1132+
./input
1133+
[@type="file"]
1134+
[@name="name"]
1135+
/following-sibling::label
1136+
[@for="name"][not(@id)]
1137+
]
1138+
'
1139+
);
1140+
}
1141+
11241142
public function testFileWithPlaceholder()
11251143
{
11261144
$form = $this->factory->createNamed('name', FileType::class);

0 commit comments

Comments
 (0)