Fix twig deprecations

pull/3006/head
Julio Montoya 6 years ago
parent 02921e34bf
commit c75c2f881f
  1. 34
      main/template/default/document/recycle.html.twig
  2. 4
      src/AdminBundle/Resources/views/standard_layout.html.twig
  3. 32
      src/CoreBundle/Resources/views/User/forms.html.twig
  4. 2
      src/CourseBundle/Entity/CDocument.php
  5. 4
      src/PageBundle/Resources/views/Block/breadcrumb.html.twig
  6. 16
      src/ThemeBundle/Resources/views/Layout/form-theme.html.twig
  7. 4
      src/ThemeBundle/Resources/views/Layout/layout_grid.html.twig
  8. 4
      src/ThemeBundle/Resources/views/grid.html.twig

@ -1,22 +1,22 @@
{% macro bytesToSize(bytes) %}
{% spaceless %}
{% set kilobyte = 1024 %}
{% set megabyte = kilobyte * 1024 %}
{% set gigabyte = megabyte * 1024 %}
{% set terabyte = gigabyte * 1024 %}
{% apply spaceless %}
{% set kilobyte = 1024 %}
{% set megabyte = kilobyte * 1024 %}
{% set gigabyte = megabyte * 1024 %}
{% set terabyte = gigabyte * 1024 %}
{% if bytes < kilobyte %}
{{ bytes ~ ' B' }}
{% elseif bytes < megabyte %}
{{ (bytes / kilobyte)|number_format(2, '.') ~ ' KB' }}
{% elseif bytes < gigabyte %}
{{ (bytes / megabyte)|number_format(2, '.') ~ ' MB' }}
{% elseif bytes < terabyte %}
{{ (bytes / gigabyte)|number_format(2, '.') ~ ' GB' }}
{% else %}
{{ (bytes / terabyte)|number_format(2, '.') ~ ' TB' }}
{% endif %}
{% endspaceless %}
{% if bytes < kilobyte %}
{{ bytes ~ ' B' }}
{% elseif bytes < megabyte %}
{{ (bytes / kilobyte)|number_format(2, '.') ~ ' KB' }}
{% elseif bytes < gigabyte %}
{{ (bytes / megabyte)|number_format(2, '.') ~ ' MB' }}
{% elseif bytes < terabyte %}
{{ (bytes / gigabyte)|number_format(2, '.') ~ ' GB' }}
{% else %}
{{ (bytes / terabyte)|number_format(2, '.') ~ ' TB' }}
{% endif %}
{% endapply %}
{% endmacro %}
{% if files %}

@ -129,7 +129,7 @@ file that was distributed with this source code.
</noscript>
{% endblock %}
{% block logo %}
{% spaceless %}
{% apply spaceless %}
<a class="logo" href="{{ path('sonata_admin_dashboard') }}">
{% if 'single_image' == sonata_admin.adminPool.getOption('title_mode') or 'both' == sonata_admin.adminPool.getOption('title_mode') %}
<img src="{{ asset(sonata_admin.adminPool.titlelogo) }}" alt="{{ sonata_admin.adminPool.title }}">
@ -138,7 +138,7 @@ file that was distributed with this source code.
<span>{{ sonata_admin.adminPool.title }}</span>
{% endif %}
</a>
{% endspaceless %}
{% endapply %}
{% endblock %}
{% block sonata_nav %}
<nav class="navbar navbar-static-top" role="navigation">

@ -11,7 +11,7 @@
{% endblock textarea_widget %}
{% block form_widget_simple %}
{% spaceless %}
{% apply spaceless %}
{% set attr = attr|merge({'class': attr.class|default('') ~ ' form-control'}) %}
{% set type = type|default('text') %}
@ -20,36 +20,36 @@
class="icon-folder-open"></i> {{ 'sylius.form.choose_file'|trans }}</span>
{% endif %}
{{ parent() }}
{% endspaceless %}
{% endapply %}
{% endblock form_widget_simple %}
{% block form_label %}
{% spaceless %}
{% apply spaceless %}
{% set label_attr = label_attr|merge({'class': label_attr.class|default('col-lg-2') ~ ' control-label'}) %}
{{ parent() }}
{% endspaceless %}
{% endapply %}
{% endblock form_label %}
{% block money_widget %}
{% spaceless %}
{% apply spaceless %}
<div class="input-group">
<span class="input-group-addon">{{ money_pattern|replace({'{{ widget }}': ''}) }}</span>
{{ block('form_widget_simple') }}
</div>
{% endspaceless %}
{% endapply %}
{% endblock money_widget %}
{% block percent_widget %}
{% spaceless %}
{% apply spaceless %}
<div class="input-group">
<span class="input-group-addon">%</span>
{{ block('form_widget_simple') }}
</div>
{% endspaceless %}
{% endapply %}
{% endblock percent_widget %}
{% block datetime_widget %}
{% spaceless %}
{% apply spaceless %}
{% if widget == 'single_text' %}
{{ block('form_widget_simple') }}
{% else %}
@ -58,11 +58,11 @@
{{ form_widget(form.time) }}
</div>
{% endif %}
{% endspaceless %}
{% endapply %}
{% endblock datetime_widget %}
{% block date_widget %}
{% spaceless %}
{% apply spaceless %}
{% if widget == 'single_text' %}
{{ block('form_widget_simple') }}
{% else %}
@ -72,22 +72,22 @@
'{{ day }}': form_widget(form.day, {'attr': {'style': 'display: inline; width: 100px;'}}),
})|raw }}
{% endif %}
{% endspaceless %}
{% endapply %}
{% endblock date_widget %}
{% block time_widget %}
{% spaceless %}
{% apply spaceless %}
{% if widget == 'single_text' %}
{{ block('form_widget_simple') }}
{% else %}
{% set vars = widget == 'text' ? { 'attr': { 'size': 1, 'style': 'width: 60px; display: inline;' }} : {} %}
&nbsp;{{ form_widget(form.hour, vars) }}{% if with_minutes %}:{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %} {{ form_widget(form.second, vars) }}{% endif %}
{% endif %}
{% endspaceless %}
{% endapply %}
{% endblock time_widget %}
{% block form_row %}
{% spaceless %}
{% apply spaceless %}
<div class="form-group{% if errors|length > 0 %} has-error{% endif %}">
{{ form_label(form) }}
<div class="col-lg-10">
@ -101,7 +101,7 @@
{% endfor %}
</div>
</div>
{% endspaceless %}
{% endapply %}
{% endblock form_row %}
{% block sonata_media_type_widget %}

@ -378,7 +378,7 @@ class CDocument extends AbstractResource implements ResourceInterface
$em = $args->getEntityManager();
$this->setId($this->iid);
$em->persist($this);
$em->flush($this);
$em->flush();
}
/**

@ -13,9 +13,9 @@ file that was distributed with this source code.
{% block label %}{{ item.label|trans(item.getExtra('translation_params', {}), item.getExtra('translation_domain', 'SonataSeoBundle')) }}{% endblock %}
{% block list %}
{% spaceless %}
{% apply spaceless %}
<div class="sonata_breadcrumb">
{{ parent() }}
</div>
{% endspaceless %}
{% endapply %}
{% endblock %}

@ -12,13 +12,13 @@
{% endblock widget_attributes %}
{% block choice_widget_expanded %}
{% spaceless %}
{% apply spaceless %}
<div {{ block('widget_container_attributes') }}>
{% for child in form %}
{{ form_widget(child) }}
{% endfor %}
</div>
{% endspaceless %}
{% endapply %}
{% endblock choice_widget_expanded %}
{% block choice_widget_collapsed %}
@ -28,7 +28,7 @@
{% block checkbox_widget %}
<div class="checkbox">
{% spaceless %}
{% apply spaceless %}
{% if not compound %}
{% set label_attr = label_attr|merge({'for': id}) %}
{% endif %}
@ -44,13 +44,13 @@
{{ label|trans({}, translation_domain) }}
{% endif %}
</label>
{% endspaceless %}
{% endapply %}
</div>
{% endblock checkbox_widget %}
{% block radio_widget %}
<div class="radio">
{% spaceless %}
{% apply spaceless %}
{% if not compound %}
{% set label_attr = label_attr|merge({'for': id}) %}
{% endif %}
@ -66,7 +66,7 @@
{{ label|trans({}, translation_domain) }}
{% endif %}
</label>
{% endspaceless %}
{% endapply %}
</div>
{% endblock radio_widget %}
@ -152,7 +152,7 @@
{% endblock form_label %}
{% block form_errors %}
{% spaceless %}
{% apply spaceless %}
{% if errors|length > 0 %}
<ul class="list-unstyled">
{% for error in errors %}
@ -160,6 +160,6 @@
{% endfor %}
</ul>
{% endif %}
{% endspaceless %}
{% endapply %}
{% endblock form_errors %}

@ -16,7 +16,7 @@
id="{{ grid.hash }}_mass_action_selected"></span>
</span>
</div>
{% spaceless %}
{% apply spaceless %}
<div style="float:right;" class="grid_massactions">
{{ 'Action'|trans }}
<input type="hidden" id="{{ grid.hash }}_mass_action_all"
@ -30,7 +30,7 @@
</select>
<input type="submit" value="{{ 'Submit Action'|trans }}"/>
</div>
{% endspaceless %}
{% endapply %}
</div>
{% endblock grid_actions %}

@ -19,7 +19,7 @@
</a>
<span class="mass-actions-selected" id="{{ grid.hash }}_mass_action_selected"></span>
</div>
{% spaceless %}
{% apply spaceless %}
<div style="float:right;" class="grid_massactions">
{{ 'Action'|trans }}
<input type="hidden" id="{{ grid.hash }}_mass_action_all"
@ -33,7 +33,7 @@
</select>
<input class="btn btn-secondary" type="submit" value="{{ 'Submit Action'|trans }}"/>
</div>
{% endspaceless %}
{% endapply %}
</div>
{% endblock grid_actions %}

Loading…
Cancel
Save