Skip to content

[Form] Remove duplicate .form-group in bootstrap 4 file field #28116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,15 @@
{%- endblock percent_widget %}

{% block file_widget -%}
<div class="form-group">
<{{ element|default('div') }} class="custom-file">
{%- set type = type|default('file') -%}
{{- block('form_widget_simple') -}}
<label for="{{ form.vars.id }}" class="custom-file-label">
{%- if attr.placeholder is defined -%}
{{- translation_domain is same as(false) ? attr.placeholder : attr.placeholder|trans({}, translation_domain) -}}
{%- endif -%}
</label>
</{{ element|default('div') }}>
</div>
<{{ element|default('div') }} class="custom-file">
{%- set type = type|default('file') -%}
{{- block('form_widget_simple') -}}
<label for="{{ form.vars.id }}" class="custom-file-label">
{%- if attr.placeholder is defined -%}
{{- translation_domain is same as(false) ? attr.placeholder : attr.placeholder|trans({}, translation_domain) -}}
{%- endif -%}
</label>
</{{ element|default('div') }}>
{% endblock %}

{% block form_widget_simple -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -942,17 +942,13 @@ public function testFile()

$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'n/a', 'attr' => array('class' => 'my&class form-control-file')),
'/div
[@class="form-group"]
[@class="custom-file"]
[
./div
[@class="custom-file"]
[
./input
[@type="file"]
[@name="name"]
/following-sibling::label
[@for="name"]
]
./input
[@type="file"]
[@name="name"]
/following-sibling::label
[@for="name"]
]
'
);
Expand All @@ -964,17 +960,13 @@ public function testFileWithPlaceholder()

$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'n/a', 'attr' => array('class' => 'my&class form-control-file', 'placeholder' => 'Custom Placeholder')),
'/div
[@class="form-group"]
[@class="custom-file"]
[
./div
[@class="custom-file"]
[
./input
[@type="file"]
[@name="name"]
/following-sibling::label
[@for="name" and text() = "[trans]Custom Placeholder[/trans]"]
]
./input
[@type="file"]
[@name="name"]
/following-sibling::label
[@for="name" and text() = "[trans]Custom Placeholder[/trans]"]
]
'
);
Expand Down