Skip to content

Commit 627a7f7

Browse files
committed
[TwigBridge] renamed some block names to avoid collisions
1 parent a30c06a commit 627a7f7

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

UPDATE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ one. It only discusses changes that need to be done when using the "public"
66
API of the framework. If you "hack" the core, you should probably follow the
77
timeline closely anyway.
88

9+
beta5 to RC1
10+
------------
11+
12+
* Some blocks in the Twig Form templates have been renamed to avoid
13+
collisions:
14+
15+
* `container_attributes` to `widget_container_attributes`
16+
* `attributes` to `widget_attributes`
17+
* `options` to `widget_choice_options`
18+
919
beta4 to beta5
1020
--------------
1121

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@
4747
{% endspaceless %}
4848
{% endblock field_rest %}
4949

50-
{% block attributes %}
50+
{% block widget_attributes %}
5151
{% spaceless %}
5252
id="{{ id }}" name="{{ full_name }}"{% if read_only %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if pattern %} pattern="{{ pattern }}"{% endif %}
5353
{% for attrname,attrvalue in attr %}{{attrname}}="{{attrvalue}}" {% endfor %}
5454
{% endspaceless %}
55-
{% endblock attributes %}
55+
{% endblock widget_attributes %}
5656

57-
{% block container_attributes %}
57+
{% block widget_container_attributes %}
5858
{% spaceless %}
5959
id="{{ id }}"
6060
{% for attrname,attrvalue in attr %}{{attrname}}="{{attrvalue}}" {% endfor %}
6161
{% endspaceless %}
62-
{% endblock container_attributes %}
62+
{% endblock widget_container_attributes %}
6363

6464
{% block form_widget %}
6565
{% spaceless %}
66-
<div {{ block('container_attributes') }}>
66+
<div {{ block('widget_container_attributes') }}>
6767
{{ block('field_rows') }}
6868
{{ form_rest(form) }}
6969
</div>
@@ -73,7 +73,7 @@
7373
{% block field_widget %}
7474
{% spaceless %}
7575
{% set type = type|default('text') %}
76-
<input type="{{ type }}" {{ block('attributes') }} value="{{ value }}" />
76+
<input type="{{ type }}" {{ block('widget_attributes') }} value="{{ value }}" />
7777
{% endspaceless %}
7878
{% endblock field_widget %}
7979

@@ -102,11 +102,11 @@
102102

103103
{% block textarea_widget %}
104104
{% spaceless %}
105-
<textarea {{ block('attributes') }}>{{ value }}</textarea>
105+
<textarea {{ block('widget_attributes') }}>{{ value }}</textarea>
106106
{% endspaceless %}
107107
{% endblock textarea_widget %}
108108

109-
{% block options %}
109+
{% block widget_choice_options %}
110110
{% spaceless %}
111111
{% for choice, label in options %}
112112
{% if _form_is_choice_group(label) %}
@@ -120,49 +120,49 @@
120120
{% endif %}
121121
{% endfor %}
122122
{% endspaceless %}
123-
{% endblock options %}
123+
{% endblock widget_choice_options %}
124124

125125
{% block choice_widget %}
126126
{% spaceless %}
127127
{% if expanded %}
128-
<div {{ block('container_attributes') }}>
128+
<div {{ block('widget_container_attributes') }}>
129129
{% for choice, child in form %}
130130
{{ form_widget(child) }}
131131
{{ form_label(child) }}
132132
{% endfor %}
133133
</div>
134134
{% else %}
135-
<select {{ block('attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
135+
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
136136
{% if empty_value is not none %}
137137
<option value="">{{ empty_value|trans }}</option>
138138
{% endif %}
139139
{% if preferred_choices|length > 0 %}
140140
{% set options = preferred_choices %}
141-
{{ block('options') }}
141+
{{ block('widget_choice_options') }}
142142
<option disabled="disabled">{{ separator }}</option>
143143
{% endif %}
144144
{% set options = choices %}
145-
{{ block('options') }}
145+
{{ block('widget_choice_options') }}
146146
</select>
147147
{% endif %}
148148
{% endspaceless %}
149149
{% endblock choice_widget %}
150150

151151
{% block checkbox_widget %}
152152
{% spaceless %}
153-
<input type="checkbox" {{ block('attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
153+
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
154154
{% endspaceless %}
155155
{% endblock checkbox_widget %}
156156

157157
{% block radio_widget %}
158158
{% spaceless %}
159-
<input type="radio" {{ block('attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
159+
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
160160
{% endspaceless %}
161161
{% endblock radio_widget %}
162162

163163
{% block datetime_widget %}
164164
{% spaceless %}
165-
<div {{ block('container_attributes') }}>
165+
<div {{ block('widget_container_attributes') }}>
166166
{{ form_errors(form.date) }}
167167
{{ form_errors(form.time) }}
168168
{{ form_widget(form.date) }}
@@ -176,7 +176,7 @@
176176
{% if widget == 'single_text' %}
177177
{{ block('text_widget') }}
178178
{% else %}
179-
<div {{ block('container_attributes') }}>
179+
<div {{ block('widget_container_attributes') }}>
180180
{{ date_pattern|replace({
181181
'{{ year }}': form_widget(form.year),
182182
'{{ month }}': form_widget(form.month),
@@ -189,7 +189,7 @@
189189

190190
{% block time_widget %}
191191
{% spaceless %}
192-
<div {{ block('container_attributes') }}>
192+
<div {{ block('widget_container_attributes') }}>
193193
{{ form_widget(form.hour, { 'attr': { 'size': '1' } }) }}:{{ form_widget(form.minute, { 'attr': { 'size': '1' } }) }}{% if with_seconds %}:{{ form_widget(form.second, { 'attr': { 'size': '1' } }) }}{% endif %}
194194
</div>
195195
{% endspaceless %}

src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
{% block form_widget %}
4040
{% spaceless %}
41-
<table {{ block('container_attributes') }}>
41+
<table {{ block('widget_container_attributes') }}>
4242
{{ block('field_rows') }}
4343
{{ form_rest(form) }}
4444
</table>

0 commit comments

Comments
 (0)