Skip to content

Commit 2e5c9e1

Browse files
authored
feat(engine-twig-php): update @basalt/twig-renderer to v3.0.1 using Twig v3.7.1 (#1499)
* feat(engine-twig-php): update @basalt/twig-renderer to v3.0.1 using Twig v3.7.1 Closes: #1496 * feat(edition-twig): alter-twig.php using Twig v3 namespaces Refs: #1496 * fix(edition-twig): deprecation message "hiding by underscore prefix"
1 parent c5ef833 commit 2e5c9e1

File tree

9 files changed

+19
-15
lines changed

9 files changed

+19
-15
lines changed

Diff for: packages/edition-twig/alter-twig.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<?php
2+
use Twig\Environment;
3+
use Twig\TwigFunction;
24

35
/**
46
* @param Twig_Environment $env - The Twig Environment - https://twig.symfony.com/api/1.x/Twig_Environment.html
57
* @param $config - Config of `@basalt/twig-renderer`
68
*/
7-
function addCustomExtension(\Twig_Environment &$env, $config) {
9+
function addCustomExtension(Environment &$env, $config) {
810

911
/**
1012
* @example `<h1>Hello {{ customTwigFunctionThatSaysWorld() }}!</h1>` => `<h1>Hello Custom World</h1>`
1113
*/
12-
// $env->addFunction(new \Twig_SimpleFunction('customTwigFunctionThatSaysWorld', function () {
14+
// $env->addFunction(new TwigFunction('customTwigFunctionThatSaysWorld', function () {
1315
// return 'Custom World';
1416
// }));
1517

@@ -18,7 +20,7 @@ function addCustomExtension(\Twig_Environment &$env, $config) {
1820
* @param string $theString
1921
* @example `<p>{{ reverse('abc') }}</p>` => `<p>cba</p>`
2022
*/
21-
// $env->addFunction(new \Twig_SimpleFunction('reverse', function ($theString) {
23+
// $env->addFunction(new TwigFunction('reverse', function ($theString) {
2224
// return strrev($theString);
2325
// }));
2426

@@ -29,6 +31,5 @@ function addCustomExtension(\Twig_Environment &$env, $config) {
2931
// $env->addGlobal('foo', 'bar');
3032

3133
// example of enabling the Twig debug mode extension (ex. {{ dump(my_variable) }} to check out the template's available data) -- comment out to disable
32-
// $env->addExtension(new \Twig_Extension_Debug());
33-
34+
// $env->addExtension(new Twig\Extension\DebugExtension());
3435
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% include '@atoms/buttons/_button.twig' with {
1+
{% include '@atoms/buttons/button.twig' with {
22
text: 'Click Me',
33
dark: true,
44
} only %}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{% include '@atoms/buttons/_button.twig' with {
1+
{% include '@atoms/buttons/button.twig' with {
22
text: 'Click Me',
33
} only %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
hidden: true
3+
---
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h1>Heading Level 1</h1>
22
<h2>Heading Level 2</h2>
3-
<h3>Heading Level 3</h3>
3+
<h3>Heading Level 3</h3>
44
<h4>Heading Level 4</h4>
5-
<h5>Heading Level 5</h5>
5+
<h5>Heading Level 5</h5>
66
<h6>Heading Level 6</h6>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="card">
22
<h2>Card Title here</h2>
3-
{% include '@atoms/buttons/_button.twig' with {
3+
{% include '@atoms/buttons/button.twig' with {
44
text: 'some text from card'
55
} only %}
66
</div>

Diff for: packages/engine-twig-php/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "6.0.1",
55
"main": "lib/engine_twig_php.js",
66
"dependencies": {
7-
"@basalt/twig-renderer": "^2.0.0",
7+
"@basalt/twig-renderer": "^3.0.1",
88
"@pattern-lab/core": "^6.0.1",
99
"chalk": "^4.1.0",
1010
"fs-extra": "10.0.0"

Diff for: yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1121,10 +1121,10 @@
11211121
"@babel/helper-validator-identifier" "^7.19.1"
11221122
to-fast-properties "^2.0.0"
11231123

1124-
"@basalt/twig-renderer@^2.0.0":
1125-
version "2.1.0"
1126-
resolved "https://registry.yarnpkg.com/@basalt/twig-renderer/-/twig-renderer-2.1.0.tgz#951e524fe1c75b37242d28d5b9552c9b1cce807b"
1127-
integrity sha512-27+8D3xJa8ht9ngo8FGsN76thAlQGsNiq5VF+rQX/aV93aGOneHGG900Tj0GqeZTKJ+F3s1O8I13JV0jcECByw==
1124+
"@basalt/twig-renderer@^3.0.1":
1125+
version "3.0.1"
1126+
resolved "https://registry.yarnpkg.com/@basalt/twig-renderer/-/twig-renderer-3.0.1.tgz#6c75dca804ed917483b3028f2bfd4130173e5c20"
1127+
integrity sha512-pLZeVxdwohW0Y3yXxnEpvJahoGPe5MSbvspeYVKMaVvUZnFD90R4plYmvHcXrMBUCwmcPU4bIOXaV/TNzxS/hg==
11281128
dependencies:
11291129
"@babel/core" "^7.2.0"
11301130
"@babel/preset-env" "^7.2.0"

0 commit comments

Comments
 (0)