Skip to content

Commit ac277ac

Browse files
authored
Merge pull request #83 from symfony2admingenerator/update-dependencies
Update dependencies, add compatibility for Twig 3
2 parents d8df0ce + 8e20cab commit ac277ac

12 files changed

+115
-108
lines changed

DependencyInjection/Configuration.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ class Configuration implements ConfigurationInterface
1717
*/
1818
public function getConfigTreeBuilder()
1919
{
20-
$treeBuilder = new TreeBuilder();
21-
$rootNode = $treeBuilder->root('admingenerator_form_extensions');
20+
$treeBuilder = new TreeBuilder('admingenerator_form_extensions');
21+
$rootNode = method_exists(TreeBuilder::class, 'getRootNode')
22+
? $treeBuilder->getRootNode()
23+
: $treeBuilder->root('admingenerator_form_extensions');
2224

2325
$rootNode
2426
->children()

Resources/config/services.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
<tag name="form.type" />
110110
</service>
111111

112-
<service id="admingenerator.form.extensions.type.hidden" class="Admingenerator\FormExtensionsBundle\Form\Type\HiddenType">
112+
<service id="admingenerator.form.extensions.type.select2_hidden" class="Admingenerator\FormExtensionsBundle\Form\Type\Select2HiddenType">
113113
<tag name="form.type" />
114114
</service>
115115

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{% if allow_add %}
2-
{% spaceless %}
2+
{% apply spaceless %}
33
<a class="btn btn-primary new">
44
<i class="fa fa-plus"></i>
55
{{- ' ' ~ 's2a_bootstrap_collection.add'|trans({}, 'AdmingeneratorFormExtensions') -}}
66
</a>
7-
{% endspaceless %}
7+
{% endapply %}
88
{% endif %}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{% if allow_delete %}
2-
{% spaceless %}
2+
{% apply spaceless %}
33
<a class="btn btn-danger batch-delete">
44
<i class="fa fa-trash-o"></i>
55
{{- ' ' ~ 's2a_bootstrap_collection.delete'|trans({}, 'AdmingeneratorFormExtensions') -}}
66
</a>
77
<label class="btn btn-link btn-toggle input-append">
88
<input type="checkbox" name="toggle">
99
</label>
10-
{% endspaceless %}
10+
{% endapply %}
1111
{% endif %}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% if allow_delete %}
2-
{% spaceless %}
2+
{% apply spaceless %}
33
<div class="collection-item-actions {{ id ~ '_actions' }}">
44
<label class="btn btn-link btn-toggle input-append">
55
<input type="checkbox" name="delete" value="1">
@@ -8,5 +8,5 @@
88
<i class="fa fa-times"></i>
99
</a>
1010
</div>
11-
{% endspaceless %}
11+
{% endapply %}
1212
{% endif %}

Resources/views/Form/SingleUpload/macros.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% macro bytesToSize(bytes) %}
2-
{% spaceless %}
2+
{% apply spaceless %}
33
{% set kilobyte = 1000 %}
44
{% set megabyte = kilobyte * 1000 %}
55
{% set gigabyte = megabyte * 1000 %}
@@ -19,5 +19,5 @@
1919
{% else %}
2020
{{ (bytes / petabyte)|number_format(2, '.') ~ ' PB' }}
2121
{% endif %}
22-
{% endspaceless %}
22+
{% endapply %}
2323
{% endmacro %}
+8-8
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
{% block s2a_collection_fieldset_css %}
2-
{% spaceless %}
2+
{% apply spaceless %}
33
{% include "@AdmingeneratorFormExtensions/Form/BootstrapCollection/stylesheet.html.twig" %}
4-
{% endspaceless %}
4+
{% endapply %}
55
{% endblock s2a_collection_fieldset_css %}
66

77
{% block s2a_collection_table_css %}
8-
{% spaceless %}
8+
{% apply spaceless %}
99
{% include "@AdmingeneratorFormExtensions/Form/BootstrapCollection/stylesheet.html.twig" %}
10-
{% endspaceless %}
10+
{% endapply %}
1111
{% endblock s2a_collection_table_css %}
1212

1313
{% block s2a_collection_upload_css %}
14-
{% spaceless %}
14+
{% apply spaceless %}
1515
{% include "@AdmingeneratorFormExtensions/Form/UploadCollection/stylesheet.html.twig" %}
16-
{% endspaceless %}
16+
{% endapply %}
1717
{% endblock s2a_collection_upload_css %}
1818

1919
{% block s2a_google_map_css %}
20-
{% spaceless %}
20+
{% apply spaceless %}
2121
{% include "@AdmingeneratorFormExtensions/Form/GoogleMap/stylesheet.html.twig" %}
22-
{% endspaceless %}
22+
{% endapply %}
2323
{% endblock s2a_google_map_css %}
2424

Resources/views/Form/form_html.html.twig

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{% block form_row %}
2-
{% spaceless %}
2+
{% apply spaceless %}
33
<div class="control-group control-group-{{ name }}{% if errors|length > 0 %} has-error{% endif %}">
44
{{ form_label(form) }}
55
{{ form_widget(form) }}
66
{{ form_errors(form) }}
77
{{ block('form_help') }}
88
</div>
9-
{% endspaceless %}
9+
{% endapply %}
1010
{% endblock form_row %}
1111

1212
{% block form_help %}
13-
{% spaceless %}
13+
{% apply spaceless %}
1414
{% if help %}
1515
<span class="help-block">
1616
<p class="muted">{{ help|trans({}, translation_domain) }}</p>
1717
</span>
1818
{% endif %}
19-
{% endspaceless %}
19+
{% endapply %}
2020
{% endblock form_help %}
2121

2222
{% block s2a_collection_fieldset_widget %}
23-
{% spaceless %}
23+
{% apply spaceless %}
2424
{% if prototype is defined %}
2525
{% set item = prototype %}
2626
{% set attr = attr|merge({'data-prototype': block('s2a_collection_fieldset_item') }) %}
@@ -39,7 +39,7 @@
3939
<div class="clearfix"></div>
4040
{{ form_rest(form) }}
4141
</div>
42-
{% endspaceless %}
42+
{% endapply %}
4343
{% endblock s2a_collection_fieldset_widget %}
4444

4545
{% block s2a_collection_fieldset_item %}
@@ -54,7 +54,7 @@
5454
{% endblock s2a_collection_fieldset_item %}
5555

5656
{% block s2a_collection_table_widget %}
57-
{% spaceless %}
57+
{% apply spaceless %}
5858
{% if prototype is defined %}
5959
{% set item = prototype %}
6060
{% set attr = attr|merge({'data-prototype': block('s2a_collection_table_item') }) %}
@@ -75,7 +75,7 @@
7575
{% endfor %}
7676
</tbody>
7777
</table>
78-
{% endspaceless %}
78+
{% endapply %}
7979
{% endblock s2a_collection_table_widget %}
8080

8181
{% block s2a_collection_table_item %}
@@ -119,7 +119,7 @@
119119
{% endblock s2a_collection_table_item %}
120120

121121
{% block s2a_upload_collection_widget %}
122-
{% spaceless %}
122+
{% apply spaceless %}
123123
{% set original_full_name = full_name %}
124124
{% set full_name = full_name ~ '[uploads][]' %}
125125
<div id="{{ id ~ '_widget_container' }}">
@@ -164,11 +164,11 @@
164164
{% include "@AdmingeneratorFormExtensions/Form/UploadCollection/template_upload.html.twig" %}
165165
{% endif %}
166166
</div>
167-
{% endspaceless %}
167+
{% endapply %}
168168
{% endblock s2a_upload_collection_widget %}
169169

170170
{% block s2a_double_list_prototype %}
171-
{% spaceless %}
171+
{% apply spaceless %}
172172
<div id="{{ id ~ '_widget_container' }}" class="double-list">
173173
<div class="col-xs-12 col-sm-5 list-unselected dropdown open">
174174
{% include "@AdmingeneratorFormExtensions/Form/DoubleList/unselected_list.html.twig" %}
@@ -181,7 +181,7 @@
181181
</div>
182182
{{ block('choice_widget') }}
183183
</div>
184-
{% endspaceless %}
184+
{% endapply %}
185185
{% endblock s2a_double_list_prototype %}
186186

187187
{% block s2a_double_list_document_widget %}
@@ -197,7 +197,7 @@
197197
{% endblock s2a_double_list_model_widget %}
198198

199199
{% block s2a_single_upload_widget %}
200-
{% spaceless %}
200+
{% apply spaceless %}
201201
<div id="{{ id ~ '_widget_container' }}" class="single-upload">
202202
<div class="btn-toolbar form-actions form-actions-condensed singleupload-buttonbar">
203203
<span class="btn btn-success fileinput">
@@ -210,7 +210,7 @@
210210
{% include "@AdmingeneratorFormExtensions/Form/SingleUpload/preview.html.twig" %}
211211
</div>
212212
</div>
213-
{% endspaceless %}
213+
{% endapply %}
214214
{% endblock s2a_single_upload_widget %}
215215

216216
{% block s2a_select2_choice_widget %}
@@ -246,7 +246,7 @@
246246
{% endblock %}
247247

248248
{% block s2a_datetime_family_prototype %}
249-
{% spaceless %}
249+
{% apply spaceless %}
250250
<input id="{{ id }}" name="{{ full_name }}" type="hidden" value="{{ value }}" />
251251
<div id="{{ id ~ '_widget' }}" class="s2a-date" {% if width is defined and width is not null %}style="width: {{ width }}px"{% endif %}>
252252
<input {{ block('s2a_datetime_family_widget_attributes') }} />
@@ -257,7 +257,7 @@
257257
<i class="{{ widgetIcon }}"></i>
258258
</a>
259259
</div>
260-
{% endspaceless %}
260+
{% endapply %}
261261
{% endblock s2a_datetime_family_prototype %}
262262

263263
{% block s2a_datetime_family_widget_attributes -%}
@@ -280,28 +280,28 @@
280280
{%- endblock s2a_datetime_family_widget_attributes %}
281281

282282
{% block s2a_datetime_picker_widget %}
283-
{% spaceless %}
283+
{% apply spaceless %}
284284
{% set widgetIcon = 'fa fa-calendar' %}
285285
{{ block('s2a_datetime_family_prototype') }}
286-
{% endspaceless %}
286+
{% endapply %}
287287
{% endblock s2a_datetime_picker_widget %}
288288

289289
{% block s2a_date_picker_widget %}
290-
{% spaceless %}
290+
{% apply spaceless %}
291291
{% set widgetIcon = 'fa fa-calendar' %}
292292
{{ block('s2a_datetime_family_prototype') }}
293-
{% endspaceless %}
293+
{% endapply %}
294294
{% endblock s2a_date_picker_widget %}
295295

296296
{% block s2a_time_picker_widget %}
297-
{% spaceless %}
297+
{% apply spaceless %}
298298
{% set widgetIcon = 'fa fa-clock-o' %}
299299
{{ block('s2a_datetime_family_prototype') }}
300-
{% endspaceless %}
300+
{% endapply %}
301301
{% endblock s2a_time_picker_widget %}
302302

303303
{% block s2a_google_map_widget %}
304-
{% spaceless %}
304+
{% apply spaceless %}
305305
<div {{ block('widget_container_attributes') }}>
306306
<div id="{{ id }}_container">
307307
<div class="input-group">
@@ -323,23 +323,23 @@
323323
{{ form_row(child) }}
324324
{% endfor %}
325325
</div>
326-
{% endspaceless %}
326+
{% endapply %}
327327
{% endblock s2a_google_map_widget %}
328328

329329
{% block s2a_money_widget %}
330-
{% spaceless %}
330+
{% apply spaceless %}
331331
<div class="input-group">
332332
<span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}': '' })|raw }}</span>
333333
{{ block('form_widget_simple')|raw }}
334334
</div>
335-
{% endspaceless %}
335+
{% endapply %}
336336
{% endblock %}
337337

338338
{% block s2a_daterange_picker_widget %}
339-
{% spaceless %}
339+
{% apply spaceless %}
340340
<div class="input-group">
341341
<span class="input-group-addon"><i class="fa fa-calendar fa-fw"></i></span>
342342
{{ block('form_widget_simple') }}
343343
</div>
344-
{% endspaceless %}
344+
{% endapply %}
345345
{% endblock s2a_daterange_picker_widget %}

0 commit comments

Comments
 (0)