Skip to content

Commit 4c36ff8

Browse files
committed
bug #7534 Fix RepeatedType fields not inheriting Bootstrap column classes (Mozoou)
This PR was submitted for the 5.x branch but it was merged into the 4.x branch instead. Discussion ---------- Fix RepeatedType fields not inheriting Bootstrap column classes Symfony defines a `repeated_row` block in `form_div_layout.html.twig` hat bypasses `form_row` entirely, rendering only child rows without any column wrapper. This caused fields using RepeatedType (e.g. password confirmation) to lose their Bootstrap grid classes. Fix by overriding `repeated_row` in EasyAdmin's form theme to apply the same column wrapper logic used in `form_row`. Fixes [#5676](#5676) <!-- Thanks for your contribution! If you are proposing a new feature that is complex, please open an issue first so we can discuss about it. Note: all your contributions adhere implicitly to the MIT license --> Commits ------- 35ac676 Fix RepeatedType fields not inheriting Bootstrap column classes
2 parents c494525 + 35ac676 commit 4c36ff8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

templates/crud/form_theme.html.twig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,20 @@
118118
{% endif %}
119119
{% endblock form_row %}
120120

121+
{% block repeated_row %}
122+
{% set field = form.vars.ea_vars.field %}
123+
124+
<div class="{{ field.columns ?? field.defaultColumns ?? '' }}">
125+
{{- block('form_rows') -}}
126+
</div>
127+
128+
{# if a field doesn't define its columns explicitly, insert a fill element to make the field take the entire row space #}
129+
{% if field.columns|default(null) is null %}
130+
<div class="flex-fill"></div>
131+
{% endif %}
132+
133+
{% endblock repeated_row %}
134+
121135
{% block choice_widget_collapsed %}
122136
{% if 'ea-autocomplete' == attr['data-ea-widget']|default(false) %}
123137
{% set attr = attr|merge({

0 commit comments

Comments
 (0)