Skip to content

Commit 1da3dd8

Browse files
committed
feature #1049 Upgrade to Twig 3 (javiereguiluz)
This PR was squashed before being merged into the master branch (closes #1049). Discussion ---------- Upgrade to Twig 3 Commits ------- c953323 Upgrade to Twig 3
2 parents c84f52a + c953323 commit 1da3dd8

11 files changed

+43
-65
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"symfony/webpack-encore-bundle": "^1.4",
3232
"symfony/yaml": "5.0.*",
3333
"tgalopin/html-sanitizer-bundle": "^1.1",
34-
"twig/extensions": "^1.5",
35-
"twig/twig": "^2.6"
34+
"twig/intl-extra": "^3.0",
35+
"twig/twig": "^3.0"
3636
},
3737
"require-dev": {
3838
"dama/doctrine-test-bundle": "^6.2",

composer.lock

Lines changed: 29 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/packages/twig_extensions.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

config/services.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ services:
3232
# 'arguments' key and define the arguments just below the service class
3333
App\EventSubscriber\CommentNotificationSubscriber:
3434
$sender: '%app.notifications.email_sender%'
35+
36+
# needed to activate the filters provided by Twig Intl Extension
37+
Twig\Extra\Intl\IntlExtension: null

symfony.lock

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -525,17 +525,8 @@
525525
"ref": "26a72f38eede2c53b5d3ccbed5c150e10a93268d"
526526
}
527527
},
528-
"twig/extensions": {
529-
"version": "1.0",
530-
"recipe": {
531-
"repo": "github.com/symfony/recipes",
532-
"branch": "master",
533-
"version": "1.0",
534-
"ref": "a86723ee8d8b2f9437c8ce60a5546a1c267da5ed"
535-
},
536-
"files": [
537-
"config/packages/twig_extensions.yaml"
538-
]
528+
"twig/intl-extra": {
529+
"version": "v3.0.0"
539530
},
540531
"twig/twig": {
541532
"version": "v2.12.2"

templates/admin/blog/index.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
{# it's not mandatory to set the timezone in localizeddate(). This is done to
2121
avoid errors when the 'intl' PHP extension is not available and the application
2222
is forced to use the limited "intl polyfill", which only supports UTC and GMT #}
23-
<td>{{ post.publishedAt|localizeddate('medium', 'short', null, 'UTC') }}</td>
23+
<td>{{ post.publishedAt|format_datetime('medium', 'short', '', 'UTC') }}</td>
2424
<td class="text-right">
2525
<div class="item-actions">
2626
<a href="{{ path('admin_post_show', {id: post.id}) }}" class="btn btn-sm btn-default">

templates/admin/blog/show.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<h1>{{ post.title }}</h1>
77

88
<p class="post-metadata">
9-
<span class="metadata"><i class="fa fa-calendar"></i> {{ post.publishedAt|localizeddate('long', 'medium', null, 'UTC') }}</span>
9+
<span class="metadata"><i class="fa fa-calendar"></i> {{ post.publishedAt|format_datetime('long', 'medium', '', 'UTC') }}</span>
1010
<span class="metadata"><i class="fa fa-user"></i> {{ post.author.fullName }}</span>
1111
</p>
1212

templates/base.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,6 @@
157157
{# it's not mandatory to set the timezone in localizeddate(). This is done to
158158
avoid errors when the 'intl' PHP extension is not available and the application
159159
is forced to use the limited "intl polyfill", which only supports UTC and GMT #}
160-
<!-- Page rendered on {{ 'now'|localizeddate('long', 'long', null, 'UTC') }} -->
160+
<!-- Page rendered on {{ 'now'|format_datetime('long', 'long', '', 'UTC') }} -->
161161
</body>
162162
</html>

templates/blog/about.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
{# it's not mandatory to set the timezone in localizeddate(). This is done to
1313
avoid errors when the 'intl' PHP extension is not available and the application
1414
is forced to use the limited "intl polyfill", which only supports UTC and GMT #}
15-
<!-- Fragment rendered on {{ 'now'|localizeddate('long', 'long', null, 'UTC') }} -->
15+
<!-- Fragment rendered on {{ 'now'|format_datetime('long', 'long', '', 'UTC') }} -->

templates/blog/index.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</h2>
1313

1414
<p class="post-metadata">
15-
<span class="metadata"><i class="fa fa-calendar"></i> {{ post.publishedAt|localizeddate('long', 'medium', null, 'UTC') }}</span>
15+
<span class="metadata"><i class="fa fa-calendar"></i> {{ post.publishedAt|format_datetime('long', 'medium', '', 'UTC') }}</span>
1616
<span class="metadata"><i class="fa fa-user"></i> {{ post.author.fullName }}</span>
1717
</p>
1818

templates/blog/post_show.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<h1>{{ post.title }}</h1>
77

88
<p class="post-metadata">
9-
<span class="metadata"><i class="fa fa-calendar"></i> {{ post.publishedAt|localizeddate('long', 'medium', null, 'UTC') }}</span>
9+
<span class="metadata"><i class="fa fa-calendar"></i> {{ post.publishedAt|format_datetime('long', 'medium', '', 'UTC') }}</span>
1010
<span class="metadata"><i class="fa fa-user"></i> {{ post.author.fullName }}</span>
1111
</p>
1212

@@ -45,7 +45,7 @@
4545
{# it's not mandatory to set the timezone in localizeddate(). This is done to
4646
avoid errors when the 'intl' PHP extension is not available and the application
4747
is forced to use the limited "intl polyfill", which only supports UTC and GMT #}
48-
<strong>{{ comment.publishedAt|localizeddate('medium', 'short', null, 'UTC') }}</strong>
48+
<strong>{{ comment.publishedAt|format_datetime('medium', 'short', '', 'UTC') }}</strong>
4949
</h4>
5050
<div class="col-sm-9">
5151
{{ comment.content|md2html }}

0 commit comments

Comments
 (0)