Skip to content

Commit 3d5fb91

Browse files
author
Michaël Perrin
committed
Conform to Twig coding standards
1 parent 43f2fa4 commit 3d5fb91

10 files changed

+19
-19
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ include('blog/_delete_post_confirmation.html.twig') }}
2-
<form action="{{ url('admin_post_delete', { id: post.id }) }}" method="post" data-confirmation="true" id="delete-form">
2+
<form action="{{ url('admin_post_delete', {id: post.id}) }}" method="post" data-confirmation="true" id="delete-form">
33
<input type="hidden" name="token" value="{{ csrf_token('delete') }}" />
44
<input type="submit" value="{{ 'action.delete_post'|trans }}" class="btn btn-lg btn-block btn-danger" />
55
</form>

app/Resources/views/admin/blog/_form.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
test the server-side validation errors from the browser. To temporarily
44
disable this validation, add the 'novalidate' attribute:
55
6-
{{ form_start(form, { attr: { novalidate: 'novalidate' } }) }}
6+
{{ form_start(form, {attr: {novalidate: 'novalidate'}}) }}
77
#}
88

99
{% if show_confirmation|default(false) %}
1010
{% set attr = {'data-confirmation': 'true'} %}
1111
{{ include('blog/_delete_post_confirmation.html.twig') }}
1212
{% endif %}
1313

14-
{{ form_start(form, { attr: attr|default({}) }) }}
14+
{{ form_start(form, {attr: attr|default({})}) }}
1515
{{ form_widget(form) }}
1616

1717
<input type="submit" value="{{ button_label|default('label.create_post'|trans) }}"

app/Resources/views/admin/blog/edit.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414

1515
{% block sidebar %}
1616
<div class="section">
17-
<a href="{{ path('admin_post_show', { id: post.id }) }}" class="btn btn-lg btn-block btn-success">
17+
<a href="{{ path('admin_post_show', {id: post.id}) }}" class="btn btn-lg btn-block btn-success">
1818
<i class="fa fa-eye" aria-hidden="true"></i> {{ 'action.show_post'|trans }}
1919
</a>
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() }}

app/Resources/views/admin/blog/index.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
<td>{{ post.publishedAt|localizeddate('medium', 'short', null, 'UTC') }}</td>
2424
<td class="text-right">
2525
<div class="item-actions">
26-
<a href="{{ path('admin_post_show', { id: post.id }) }}" class="btn btn-sm btn-default">
26+
<a href="{{ path('admin_post_show', {id: post.id}) }}" class="btn btn-sm btn-default">
2727
{{ 'action.show'|trans }}
2828
</a>
2929

30-
<a href="{{ path('admin_post_edit', { id: post.id }) }}" class="btn btn-sm btn-primary">
30+
<a href="{{ path('admin_post_edit', {id: post.id}) }}" class="btn btn-sm btn-primary">
3131
<i class="fa fa-edit" aria-hidden="true"></i> {{ 'action.edit'|trans }}
3232
</a>
3333
</div>

app/Resources/views/admin/blog/new.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{{ form_row(form.tags) }}
1414

1515
<input type="submit" value="{{ 'label.create_post'|trans }}" class="btn btn-primary" />
16-
{{ form_widget(form.saveAndCreateNew, { label: 'label.save_and_create_new', attr: { class: 'btn btn-primary' } }) }}
16+
{{ form_widget(form.saveAndCreateNew, {label: 'label.save_and_create_new', attr: {class: 'btn btn-primary'}}) }}
1717
<a href="{{ path('admin_post_index') }}" class="btn btn-link">
1818
{{ 'action.back_to_list'|trans }}
1919
</a>

app/Resources/views/admin/blog/show.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222
{% block sidebar %}
2323
<div class="section">
24-
<a href="{{ path('admin_post_edit', { id: post.id }) }}" class="btn btn-lg btn-block btn-success">
24+
<a href="{{ path('admin_post_edit', {id: post.id}) }}" class="btn btn-lg btn-block btn-success">
2525
<i class="fa fa-edit" aria-hidden="true"></i> {{ 'action.edit_contents'|trans }}
2626
</a>
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() }}

app/Resources/views/base.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
</a>
7878
<ul class="dropdown-menu locales" role="menu" aria-labelledby="locales">
7979
{% for locale in locales() %}
80-
<li {% if app.request.locale == locale.code %}aria-checked="true" class="active"{%else%}aria-checked="false"{% endif %} role="menuitem"><a href="{{ path(app.request.get('_route', 'blog_index'), app.request.get('_route_params', [])|merge({ _locale: locale.code })) }}">{{ locale.name|capitalize }}</a></li>
80+
<li {% if app.request.locale == locale.code %}aria-checked="true" class="active"{% else %}aria-checked="false"{% endif %} role="menuitem"><a href="{{ path(app.request.get('_route', 'blog_index'), app.request.get('_route_params', [])|merge({_locale: locale.code})) }}">{{ locale.name|capitalize }}</a></li>
8181
{% endfor %}
8282
</ul>
8383
</li>

app/Resources/views/blog/_comment_form.html.twig

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
test the server-side validation errors from the browser. To temporarily
44
disable this validation, add the 'novalidate' attribute:
55
6-
{{ form_start(form, { method: ..., action: ..., attr: { novalidate: 'novalidate' } }) }}
6+
{{ 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
{# instead of displaying form fields one by one, you can also display them
1111
all with their default options and styles just by calling to this function:
1212
@@ -20,12 +20,12 @@
2020
{{ form_errors(form) }}
2121

2222
<div class="form-group {% if not form.content.vars.valid %}has-error{% endif %}">
23-
{{ form_label(form.content, 'label.content', { label_attr: { class: 'hidden' }}) }}
23+
{{ form_label(form.content, 'label.content', {label_attr: {class: 'hidden'}}) }}
2424

2525
{# Render any errors for the "content" field (e.g. when a class property constraint failed) #}
2626
{{ form_errors(form.content) }}
2727

28-
{{ form_widget(form.content, { attr: { rows: 10 } }) }}
28+
{{ form_widget(form.content, {attr: {rows: 10}}) }}
2929
</div>
3030

3131
<div class="form-group">

app/Resources/views/blog/index.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{% for post in posts %}
77
<article class="post">
88
<h2>
9-
<a href="{{ path('blog_post', { slug: post.slug }) }}">
9+
<a href="{{ path('blog_post', {slug: post.slug}) }}">
1010
{{ post.title }}
1111
</a>
1212
</h2>
@@ -26,7 +26,7 @@
2626

2727
{% if posts.haveToPaginate %}
2828
<div class="navigation text-center">
29-
{{ pagerfanta(posts, 'twitter_bootstrap3_translated', { routeName: 'blog_index_paginated' }) }}
29+
{{ pagerfanta(posts, 'twitter_bootstrap3_translated', {routeName: 'blog_index_paginated'}) }}
3030
</div>
3131
{% endif %}
3232
{% endblock %}

app/Resources/views/blog/post_show.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
See http://symfony.com/doc/current/cookbook/security/remember_me.html#forcing-the-user-to-re-authenticate-before-accessing-certain-resources
2323
#}
2424
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
25-
{{ render(controller('AppBundle:Blog:commentForm', { 'id': post.id })) }}
25+
{{ render(controller('AppBundle:Blog:commentForm', {'id': post.id})) }}
2626
{% else %}
2727
<p>
2828
<a class="btn btn-success" href="{{ path('security_login') }}">
@@ -59,7 +59,7 @@
5959
{% block sidebar %}
6060
{% if is_granted('edit', post) %}
6161
<div class="section">
62-
<a class="btn btn-lg btn-block btn-success" href="{{ path('admin_post_edit', { id: post.id }) }}">
62+
<a class="btn btn-lg btn-block btn-success" href="{{ path('admin_post_edit', {id: post.id}) }}">
6363
<i class="fa fa-edit" aria-hidden="true"></i> {{ 'action.edit_post'|trans }}
6464
</a>
6565
</div>

0 commit comments

Comments
 (0)