Skip to content

[TwigBridge] Add row_attr to all form themes #33573

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

Merged
merged 1 commit into from
Nov 28, 2019
Merged
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 @@ -27,7 +27,7 @@ col-sm-2
{%- if help is not empty -%}
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
{%- endif -%}
<div class="form-group{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}">
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ ((not compound or force_error|default(false)) and not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
{{- form_label(form) -}}
<div class="{{ block('form_group_class') }}">
{{- form_widget(form, widget_attr) -}}
Expand All @@ -38,7 +38,7 @@ col-sm-2
{%- endblock form_row %}

{% block submit_row -%}
<div class="form-group">{#--#}
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
Expand All @@ -47,7 +47,7 @@ col-sm-2
{%- endblock submit_row %}

{% block reset_row -%}
<div class="form-group">{#--#}
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
Expand All @@ -60,7 +60,7 @@ col-sm-10
{%- endblock form_group_class %}

{% block checkbox_row -%}
<div class="form-group{% if not valid %} has-error{% endif %}">{#--#}
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
{%- if help is not empty -%}
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
{%- endif -%}
<div class="form-group{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}">
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ ((not compound or force_error|default(false)) and not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
{{- form_label(form) }} {# -#}
{{ form_widget(form, widget_attr) }} {# -#}
{{- form_help(form) -}}
Expand All @@ -120,7 +120,7 @@
{%- endblock form_row %}

{% block button_row -%}
<div class="form-group">
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>
{{- form_widget(form) -}}
</div>
{%- endblock button_row %}
Expand All @@ -146,14 +146,14 @@
{%- endblock datetime_row %}

{% block checkbox_row -%}
<div class="form-group{% if not valid %} has-error{% endif %}">
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
{{- form_widget(form) -}}
{{- form_errors(form) -}}
</div>
{%- endblock checkbox_row %}

{% block radio_row -%}
<div class="form-group{% if not valid %} has-error{% endif %}">
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group' ~ (not valid ? ' has-error'))|trim})} %}{{ block('attributes') }}{% endwith %}>
{{- form_widget(form) -}}
{{- form_errors(form) -}}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ col-sm-2
{%- if help is not empty -%}
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
{%- endif -%}
<div class="form-group row{% if (not compound or force_error|default(false)) and not valid %} is-invalid{% endif %}">
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group row' ~ ((not compound or force_error|default(false)) and not valid ? ' is-invalid'))|trim})} %}{{ block('attributes') }}{% endwith %}>
{{- form_label(form) -}}
<div class="{{ block('form_group_class') }}">
{{- form_widget(form, widget_attr) -}}
Expand All @@ -43,7 +43,7 @@ col-sm-2
{%- if help is not empty -%}
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
{%- endif -%}
<fieldset class="form-group">
<fieldset{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>
<div class="row{% if (not compound or force_error|default(false)) and not valid %} is-invalid{% endif %}">
{{- form_label(form) -}}
<div class="{{ block('form_group_class') }}">
Expand All @@ -55,7 +55,7 @@ col-sm-2
{%- endblock fieldset_form_row %}

{% block submit_row -%}
<div class="form-group row">{#--#}
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group row')|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
Expand All @@ -64,7 +64,7 @@ col-sm-2
{%- endblock submit_row %}

{% block reset_row -%}
<div class="form-group row">{#--#}
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group row')|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
Expand All @@ -77,7 +77,7 @@ col-sm-10
{%- endblock form_group_class %}

{% block checkbox_row -%}
<div class="form-group row">{#--#}
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group row')|trim})} %}{{ block('attributes') }}{% endwith %}>{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
{%- if help is not empty -%}
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
{%- endif -%}
<{{ element|default('div') }} class="form-group">
<{{ element|default('div') }}{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>
{{- form_label(form) -}}
{{- form_widget(form, widget_attr) -}}
{{- form_help(form) -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
{# Rows #}

{% block button_row -%}
<div class="form-group">
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}>
{{- form_widget(form) -}}
</div>
{%- endblock button_row %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
{%- if help is not empty -%}
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
{%- endif -%}
<div {% with {attr: row_attr|default({})} %}{{ block('attributes') }}{% endwith %}>
<div{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
{{- form_label(form) -}}
{{- form_errors(form) -}}
{{- form_widget(form, widget_attr) -}}
Expand All @@ -334,7 +334,7 @@
{%- endblock form_row -%}

{%- block button_row -%}
<div {% with {attr: row_attr|default({})} %}{{ block('attributes') }}{% endwith %}>
<div{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
{{- form_widget(form) -}}
</div>
{%- endblock button_row -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{%- if help is not empty -%}
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
{%- endif -%}
<tr>
<tr{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
<td>
{{- form_label(form) -}}
</td>
Expand All @@ -18,7 +18,7 @@
{%- endblock form_row -%}

{%- block button_row -%}
<tr>
<tr{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
<td></td>
<td>
{{- form_widget(form) -}}
Expand All @@ -27,7 +27,8 @@
{%- endblock button_row -%}

{%- block hidden_row -%}
<tr style="display: none">
{%- set style = row_attr.style is defined ? (row_attr.style ~ (row_attr.style|trim|last != ';' ? '; ')) : '' -%}
<tr{% with {attr: row_attr|merge({style: (style ~ ' display: none')|trim})} %}{{ block('attributes') }}{% endwith %}>
<td colspan="2">
{{- form_widget(form) -}}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
{%- if help is not empty -%}
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
{%- endif -%}
<div class="row">
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
<div class="large-12 columns{% if (not compound or force_error|default(false)) and not valid %} error{% endif %}">
{{- form_label(form) -}}
{{- form_widget(form, widget_attr) -}}
Expand Down Expand Up @@ -308,7 +308,7 @@
{%- endblock datetime_row %}

{% block checkbox_row -%}
<div class="row">
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
<div class="large-12 columns{% if not valid %} error{% endif %}">
{{ form_widget(form) }}
{{ form_errors(form) }}
Expand All @@ -317,7 +317,7 @@
{%- endblock checkbox_row %}

{% block radio_row -%}
<div class="row">
<div{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' row')|trim})} %}{{ block('attributes') }}{% endwith %}>
<div class="large-12 columns{% if not valid %} error{% endif %}">
{{ form_widget(form) }}
{{ form_errors(form) }}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"symfony/asset": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/finder": "~3.4|~4.0",
"symfony/form": "^4.3.4",
"symfony/form": "^4.3.5",
"symfony/http-foundation": "~4.3",
"symfony/http-kernel": "~3.4|~4.0",
"symfony/mime": "~4.3",
Expand All @@ -48,7 +48,7 @@
},
"conflict": {
"symfony/console": "<3.4",
"symfony/form": "<4.3.4",
"symfony/form": "<4.3.5",
"symfony/http-foundation": "<4.3",
"symfony/translation": "<4.2",
"symfony/workflow": "<4.3"
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"symfony/css-selector": "~3.4|~4.0",
"symfony/dom-crawler": "^4.3",
"symfony/polyfill-intl-icu": "~1.0",
"symfony/form": "^4.3.4",
"symfony/form": "^4.3.5",
"symfony/expression-language": "~3.4|~4.0",
"symfony/http-client": "^4.3",
"symfony/mailer": "^4.3",
Expand Down Expand Up @@ -72,7 +72,7 @@
"symfony/console": "<4.3",
"symfony/dotenv": "<4.2",
"symfony/dom-crawler": "<4.3",
"symfony/form": "<4.3",
"symfony/form": "<4.3.5",
"symfony/messenger": "<4.3.6",
"symfony/property-info": "<3.4",
"symfony/serializer": "<4.2",
Expand Down