Skip to content

Commit c359770

Browse files
committed
feature #1613 Apply Twig coding standard rules (rosier)
This PR was merged into the main branch. Discussion ---------- Apply Twig coding standard rules Thanks to the [Twig CS Fixer](https://github.com/VincentLanglet/Twig-CS-Fixer) I ran the following command ``` twig-cs-fixer lint --fix templates ``` I used the default settings (no configuration file). Commits ------- 850a8c2 Apply Twig coding standard rules
2 parents edd624a + 850a8c2 commit c359770

File tree

15 files changed

+27
-29
lines changed

15 files changed

+27
-29
lines changed

templates/admin/blog/_form.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{{ form_start(form, {attr: attr|default({})}) }}
1515
{{ form_widget(form) }}
1616

17-
<button type="submit" class="{{ button_css|default("btn btn-primary") }}">
17+
<button type="submit" class="{{ button_css|default('btn btn-primary') }}">
1818
<twig:ux:icon name="tabler:save-changes"/> {{ button_label|default('label.create_post'|trans) }}
1919
</button>
2020

templates/admin/blog/edit.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
{% block body_id 'admin_post_edit' %}
44

55
{% block main %}
6-
<h1>{{ 'title.edit_post'|trans({'id': post.id}) }}</h1>
6+
<h1>{{ 'title.edit_post'|trans({id: post.id}) }}</h1>
77

88
{{ include('admin/blog/_form.html.twig', {
99
form: form,
1010
button_label: 'action.save'|trans,
1111
include_back_to_home_link: true,
12-
}, with_context = false) }}
12+
}, with_context: false) }}
1313
{% endblock %}
1414

1515
{% block sidebar %}
@@ -20,7 +20,7 @@
2020
</div>
2121

2222
<div class="section actions">
23-
{{ include('admin/blog/_delete_form.html.twig', {post: post}, with_context = false) }}
23+
{{ include('admin/blog/_delete_form.html.twig', {post: post}, with_context: false) }}
2424
</div>
2525

2626
{{ parent() }}

templates/admin/blog/show.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</div>
2828

2929
<div class="section">
30-
{{ include('admin/blog/_delete_form.html.twig', {post: post}, with_context = false) }}
30+
{{ include('admin/blog/_delete_form.html.twig', {post: post}, with_context: false) }}
3131
</div>
3232

3333
{{ parent() }}

templates/admin/layout.html.twig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@
2424
</a>
2525
</li>
2626
{% endblock %}
27-

templates/base.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@
9999
<div id="sidebar" class="col-sm-3">
100100
{% block sidebar %}
101101
{{ render_esi(controller('Symfony\\Bundle\\FrameworkBundle\\Controller\\TemplateController::templateAction', {
102-
'template': 'blog/about.html.twig',
103-
'sharedAge': 600,
104-
'_locale': app.locale
102+
template: 'blog/about.html.twig',
103+
sharedAge: 600,
104+
_locale: app.locale,
105105
})) }}
106106
{% endblock %}
107107
</div>

templates/blog/_comment_form.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{{ form_start(form, {method: ..., action: ..., attr: {novalidate: 'novalidate'}}) }}
77
#}
88

9-
{{ form_start(form, {method: 'POST', action: path('comment_new', {'postSlug': post.slug})}) }}
9+
{{ form_start(form, {method: 'POST', action: path('comment_new', {postSlug: post.slug})}) }}
1010
{#
1111
Instead of displaying form fields one by one, you can also display them
1212
all with their default options and styles just by calling to this function:
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{% if not post.tags.empty %}
22
<p class="post-tags">
33
{% for tag in post.tags %}
4-
<a href="{{ path('blog_index', {'tag': tag.name == app.request.query.get('tag') ? null : tag.name}) }}"
4+
<a href="{{ path('blog_index', {tag: tag.name == app.request.query.get('tag') ? null : tag.name}) }}"
55
class="badge badge-{{ tag.name == app.request.query.get('tag') ? 'success' : 'secondary' }}"
66
>
77
<twig:ux:icon name="tabler:tag" style="top: 0"/> {{ tag.name }}
88
</a>
99
{% endfor %}
1010
</p>
1111
{% endif %}
12-

templates/blog/index.xml.twig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
<channel>
44
<title>{{ 'rss.title'|trans }}</title>
55
<description>{{ 'rss.description'|trans }}</description>
6-
<pubDate>{{ 'now'|date('r', timezone='GMT') }}</pubDate>
7-
<lastBuildDate>{{ (paginator.results|last).publishedAt|default('now')|date('r', timezone='GMT') }}</lastBuildDate>
6+
<pubDate>{{ 'now'|date('r', timezone: 'GMT') }}</pubDate>
7+
<lastBuildDate>{{ (paginator.results|last).publishedAt|default('now')|date('r', timezone: 'GMT') }}</lastBuildDate>
88
<link>{{ url('blog_index') }}</link>
99
<language>{{ app.locale }}</language>
1010

1111
{% for post in paginator.results %}
1212
<item>
1313
<title>{{ post.title }}</title>
1414
<description>{{ post.summary }}</description>
15-
<link>{{ url('blog_post', {'slug': post.slug}) }}</link>
16-
<guid>{{ url('blog_post', {'slug': post.slug}) }}</guid>
17-
<pubDate>{{ post.publishedAt|date(format='r', timezone='GMT') }}</pubDate>
15+
<link>{{ url('blog_post', {slug: post.slug}) }}</link>
16+
<guid>{{ url('blog_post', {slug: post.slug}) }}</guid>
17+
<pubDate>{{ post.publishedAt|date(format: 'r', timezone: 'GMT') }}</pubDate>
1818
<author>{{ post.author.email }}</author>
1919
{% for tag in post.tags %}
2020
<category>{{ tag.name }}</category>

templates/blog/post_show.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{{ render(controller('App\\Controller\\BlogController::commentForm', {post})) }}
3131
{% else %}
3232
<p>
33-
<a class="btn btn-success" href="{{ path('security_login', {'redirect_to': app.request.pathInfo}) }}">
33+
<a class="btn btn-success" href="{{ path('security_login', {redirect_to: app.request.pathInfo}) }}">
3434
<twig:ux:icon name="tabler:login"/> {{ 'action.sign_in'|trans }}
3535
</a>
3636
{{ 'post.to_publish_a_comment'|trans }}
@@ -39,7 +39,7 @@
3939
</div>
4040

4141
<h3>
42-
<twig:ux:icon name="tabler:messages"/> {{ 'post.num_comments'|trans({ 'count': post.comments|length }) }}
42+
<twig:ux:icon name="tabler:messages"/> {{ 'post.num_comments'|trans({count: post.comments|length}) }}
4343
</h3>
4444

4545
{% for comment in post.comments %}

templates/blog/search.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
See https://symfony.com/bundles/ux-twig-component/current/index.html
99
#}
1010
{{ component('blog_search', {
11-
query: query
11+
query: query,
1212
}) }}
1313
{% endblock %}
1414

0 commit comments

Comments
 (0)