Skip to content

Commit

Permalink
Merge pull request #83 from symfony2admingenerator/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies, add compatibility for Twig 3
  • Loading branch information
tobias-93 authored Dec 16, 2020
2 parents d8df0ce + 8e20cab commit ac277ac
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 108 deletions.
6 changes: 4 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('admingenerator_form_extensions');
$treeBuilder = new TreeBuilder('admingenerator_form_extensions');
$rootNode = method_exists(TreeBuilder::class, 'getRootNode')
? $treeBuilder->getRootNode()
: $treeBuilder->root('admingenerator_form_extensions');

$rootNode
->children()
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<tag name="form.type" />
</service>

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% if allow_add %}
{% spaceless %}
{% apply spaceless %}
<a class="btn btn-primary new">
<i class="fa fa-plus"></i>
{{- ' ' ~ 's2a_bootstrap_collection.add'|trans({}, 'AdmingeneratorFormExtensions') -}}
</a>
{% endspaceless %}
{% endapply %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% if allow_delete %}
{% spaceless %}
{% apply spaceless %}
<a class="btn btn-danger batch-delete">
<i class="fa fa-trash-o"></i>
{{- ' ' ~ 's2a_bootstrap_collection.delete'|trans({}, 'AdmingeneratorFormExtensions') -}}
</a>
<label class="btn btn-link btn-toggle input-append">
<input type="checkbox" name="toggle">
</label>
{% endspaceless %}
{% endapply %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if allow_delete %}
{% spaceless %}
{% apply spaceless %}
<div class="collection-item-actions {{ id ~ '_actions' }}">
<label class="btn btn-link btn-toggle input-append">
<input type="checkbox" name="delete" value="1">
Expand All @@ -8,5 +8,5 @@
<i class="fa fa-times"></i>
</a>
</div>
{% endspaceless %}
{% endapply %}
{% endif %}
4 changes: 2 additions & 2 deletions Resources/views/Form/SingleUpload/macros.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro bytesToSize(bytes) %}
{% spaceless %}
{% apply spaceless %}
{% set kilobyte = 1000 %}
{% set megabyte = kilobyte * 1000 %}
{% set gigabyte = megabyte * 1000 %}
Expand All @@ -19,5 +19,5 @@
{% else %}
{{ (bytes / petabyte)|number_format(2, '.') ~ ' PB' }}
{% endif %}
{% endspaceless %}
{% endapply %}
{% endmacro %}
16 changes: 8 additions & 8 deletions Resources/views/Form/form_css.html.twig
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{% block s2a_collection_fieldset_css %}
{% spaceless %}
{% apply spaceless %}
{% include "@AdmingeneratorFormExtensions/Form/BootstrapCollection/stylesheet.html.twig" %}
{% endspaceless %}
{% endapply %}
{% endblock s2a_collection_fieldset_css %}

{% block s2a_collection_table_css %}
{% spaceless %}
{% apply spaceless %}
{% include "@AdmingeneratorFormExtensions/Form/BootstrapCollection/stylesheet.html.twig" %}
{% endspaceless %}
{% endapply %}
{% endblock s2a_collection_table_css %}

{% block s2a_collection_upload_css %}
{% spaceless %}
{% apply spaceless %}
{% include "@AdmingeneratorFormExtensions/Form/UploadCollection/stylesheet.html.twig" %}
{% endspaceless %}
{% endapply %}
{% endblock s2a_collection_upload_css %}

{% block s2a_google_map_css %}
{% spaceless %}
{% apply spaceless %}
{% include "@AdmingeneratorFormExtensions/Form/GoogleMap/stylesheet.html.twig" %}
{% endspaceless %}
{% endapply %}
{% endblock s2a_google_map_css %}

56 changes: 28 additions & 28 deletions Resources/views/Form/form_html.html.twig
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{% block form_row %}
{% spaceless %}
{% apply spaceless %}
<div class="control-group control-group-{{ name }}{% if errors|length > 0 %} has-error{% endif %}">
{{ form_label(form) }}
{{ form_widget(form) }}
{{ form_errors(form) }}
{{ block('form_help') }}
</div>
{% endspaceless %}
{% endapply %}
{% endblock form_row %}

{% block form_help %}
{% spaceless %}
{% apply spaceless %}
{% if help %}
<span class="help-block">
<p class="muted">{{ help|trans({}, translation_domain) }}</p>
</span>
{% endif %}
{% endspaceless %}
{% endapply %}
{% endblock form_help %}

{% block s2a_collection_fieldset_widget %}
{% spaceless %}
{% apply spaceless %}
{% if prototype is defined %}
{% set item = prototype %}
{% set attr = attr|merge({'data-prototype': block('s2a_collection_fieldset_item') }) %}
Expand All @@ -39,7 +39,7 @@
<div class="clearfix"></div>
{{ form_rest(form) }}
</div>
{% endspaceless %}
{% endapply %}
{% endblock s2a_collection_fieldset_widget %}

{% block s2a_collection_fieldset_item %}
Expand All @@ -54,7 +54,7 @@
{% endblock s2a_collection_fieldset_item %}

{% block s2a_collection_table_widget %}
{% spaceless %}
{% apply spaceless %}
{% if prototype is defined %}
{% set item = prototype %}
{% set attr = attr|merge({'data-prototype': block('s2a_collection_table_item') }) %}
Expand All @@ -75,7 +75,7 @@
{% endfor %}
</tbody>
</table>
{% endspaceless %}
{% endapply %}
{% endblock s2a_collection_table_widget %}

{% block s2a_collection_table_item %}
Expand Down Expand Up @@ -119,7 +119,7 @@
{% endblock s2a_collection_table_item %}

{% block s2a_upload_collection_widget %}
{% spaceless %}
{% apply spaceless %}
{% set original_full_name = full_name %}
{% set full_name = full_name ~ '[uploads][]' %}
<div id="{{ id ~ '_widget_container' }}">
Expand Down Expand Up @@ -164,11 +164,11 @@
{% include "@AdmingeneratorFormExtensions/Form/UploadCollection/template_upload.html.twig" %}
{% endif %}
</div>
{% endspaceless %}
{% endapply %}
{% endblock s2a_upload_collection_widget %}

{% block s2a_double_list_prototype %}
{% spaceless %}
{% apply spaceless %}
<div id="{{ id ~ '_widget_container' }}" class="double-list">
<div class="col-xs-12 col-sm-5 list-unselected dropdown open">
{% include "@AdmingeneratorFormExtensions/Form/DoubleList/unselected_list.html.twig" %}
Expand All @@ -181,7 +181,7 @@
</div>
{{ block('choice_widget') }}
</div>
{% endspaceless %}
{% endapply %}
{% endblock s2a_double_list_prototype %}

{% block s2a_double_list_document_widget %}
Expand All @@ -197,7 +197,7 @@
{% endblock s2a_double_list_model_widget %}

{% block s2a_single_upload_widget %}
{% spaceless %}
{% apply spaceless %}
<div id="{{ id ~ '_widget_container' }}" class="single-upload">
<div class="btn-toolbar form-actions form-actions-condensed singleupload-buttonbar">
<span class="btn btn-success fileinput">
Expand All @@ -210,7 +210,7 @@
{% include "@AdmingeneratorFormExtensions/Form/SingleUpload/preview.html.twig" %}
</div>
</div>
{% endspaceless %}
{% endapply %}
{% endblock s2a_single_upload_widget %}

{% block s2a_select2_choice_widget %}
Expand Down Expand Up @@ -246,7 +246,7 @@
{% endblock %}

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

{% block s2a_datetime_family_widget_attributes -%}
Expand All @@ -280,28 +280,28 @@
{%- endblock s2a_datetime_family_widget_attributes %}

{% block s2a_datetime_picker_widget %}
{% spaceless %}
{% apply spaceless %}
{% set widgetIcon = 'fa fa-calendar' %}
{{ block('s2a_datetime_family_prototype') }}
{% endspaceless %}
{% endapply %}
{% endblock s2a_datetime_picker_widget %}

{% block s2a_date_picker_widget %}
{% spaceless %}
{% apply spaceless %}
{% set widgetIcon = 'fa fa-calendar' %}
{{ block('s2a_datetime_family_prototype') }}
{% endspaceless %}
{% endapply %}
{% endblock s2a_date_picker_widget %}

{% block s2a_time_picker_widget %}
{% spaceless %}
{% apply spaceless %}
{% set widgetIcon = 'fa fa-clock-o' %}
{{ block('s2a_datetime_family_prototype') }}
{% endspaceless %}
{% endapply %}
{% endblock s2a_time_picker_widget %}

{% block s2a_google_map_widget %}
{% spaceless %}
{% apply spaceless %}
<div {{ block('widget_container_attributes') }}>
<div id="{{ id }}_container">
<div class="input-group">
Expand All @@ -323,23 +323,23 @@
{{ form_row(child) }}
{% endfor %}
</div>
{% endspaceless %}
{% endapply %}
{% endblock s2a_google_map_widget %}

{% block s2a_money_widget %}
{% spaceless %}
{% apply spaceless %}
<div class="input-group">
<span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}': '' })|raw }}</span>
{{ block('form_widget_simple')|raw }}
</div>
{% endspaceless %}
{% endapply %}
{% endblock %}

{% block s2a_daterange_picker_widget %}
{% spaceless %}
{% apply spaceless %}
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-calendar fa-fw"></i></span>
{{ block('form_widget_simple') }}
</div>
{% endspaceless %}
{% endapply %}
{% endblock s2a_daterange_picker_widget %}
Loading

0 comments on commit ac277ac

Please sign in to comment.