diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e99913..513d2b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ + +# [3.1.0](https://github.com/flextype-plugins/twig/compare/v3.0.0...v3.1.0) (2022-09-13) + +### Features + +* **core** update code base for new Flextype 1.0.0-alpha.2 release. + # [3.0.0](https://github.com/flextype-plugins/twig/compare/v2.1.0...v3.0.0) (2022-07-11) diff --git a/README.md b/README.md index 1559c05..41a9d8b 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Twig Plugin for Flextype

-License MIT GitHub Repo stars GitHub forks Hits of Code Discord +License MIT GitHub Repo stars GitHub forks Hits of Code

Twig plugin to present Twig template engine for Flextype. @@ -12,7 +12,7 @@ The following dependencies need to be downloaded and installed for Twig Plugin. | Item | Version | Download | |---|---|---| -| [flextype](https://github.com/flextype/flextype) | ^1.0.0-alpha.1 | [download](https://github.com/flextype/flextype/releases) | +| [flextype](https://github.com/flextype/flextype) | ^1.0.0-alpha.2 | [download](https://github.com/flextype/flextype/releases) | ## Installation diff --git a/composer.json b/composer.json index b685602..a1f7ff2 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ }, "require": { "php": "^8.1", - "twig/twig": "^3.4.1", + "twig/twig": "^3.4.2", "slim/flash": "~0.4.0" }, "config": { diff --git a/plugin.php b/plugin.php index 1f01cf0..0984fb3 100644 --- a/plugin.php +++ b/plugin.php @@ -80,10 +80,10 @@ }); // Init Twig Shortcodes -parsers()->shortcodes()->initShortcodes(registry()->get('plugins.twig.settings.parsers.shortcodes.shortcodes')); +parsers()->shortcodes()->registerShortcodes(registry()->get('plugins.twig.settings.parsers.shortcodes.shortcodes')); // Init Twig Directives -entries()->initDirectives(registry()->get('plugins.twig.settings.entries.directives')); +entries()->registerDirectives(registry()->get('plugins.twig.settings.entries.directives')); -// Init Twig Expressions -entries()->initExpressions(registry()->get('plugins.twig.settings.entries.expressions')); \ No newline at end of file +// Register Twig Expressions +parsers()->expressions()->registerExpressions(registry()->get('plugins.twig.settings.entries.expressions')); \ No newline at end of file diff --git a/plugin.yaml b/plugin.yaml index 5ec8b10..81979aa 100755 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,5 +1,5 @@ name: Twig -version: 3.0.0 +version: 3.1.0 description: Twig plugin to present Twig template engine for Flextype. icon: name: palette @@ -14,4 +14,4 @@ bugs: https://github.com/flextype-plugins/twig/issues license: MIT dependencies: - flextype: "^1.0.0-alpha.1" + flextype: "^1.0.0-alpha.2" diff --git a/release.sh b/release.sh new file mode 100644 index 0000000..20f4e9d --- /dev/null +++ b/release.sh @@ -0,0 +1,17 @@ +# Release build script for Twig Plugin +# Copyright (c) Sergey Romanenko +# usage: bash release.sh [version] + +name="twig"; +version="$1"; +curl "https://github.com/flextype-plugins/$name/archive/refs/tags/v$version.zip" -L -O; +unzip "v$version.zip"; +rm "v$version.zip"; +cd "$name-$version"; +composer install --no-dev; +rm -rf __MACOSX; +find . -name '.DS_Store' -type f -delete; +zip -r "$name-$version.zip" . ; +cd ../; +mv "$name-$version/$name-$version.zip" .; +rm -r "$name-$version/"; \ No newline at end of file diff --git a/settings.yaml b/settings.yaml index 2535f0f..bae191a 100644 --- a/settings.yaml +++ b/settings.yaml @@ -58,6 +58,7 @@ extensions: - Cache - Image - Url + - Vars # Twig plugin priority priority: 0 diff --git a/src/twig/core/Entries/Directives/TwigDirective.php b/src/twig/core/Entries/Directives/TwigDirective.php index ddf1534..ead3f33 100644 --- a/src/twig/core/Entries/Directives/TwigDirective.php +++ b/src/twig/core/Entries/Directives/TwigDirective.php @@ -18,8 +18,8 @@ use function Glowy\Strings\strings; use function Flextype\entries; use function Flextype\registry; -use function Flextype\Plugin\twig; use function Flextype\emitter; +use function Flextype\Plugin\Twig\twig; // Directive: @twig emitter()->addListener('onEntriesFetchSingleField', static function (): void { diff --git a/src/twig/core/Extensions/VarsTwigExtension.php b/src/twig/core/Extensions/VarsTwigExtension.php new file mode 100644 index 0000000..fb01c58 --- /dev/null +++ b/src/twig/core/Extensions/VarsTwigExtension.php @@ -0,0 +1,36 @@ + '(new TwigExpressionMethods())', fn($arguments) => (new TwigExpressionMethods())) + new ExpressionFunction('twig', fn() => '(new \Flextype\Plugin\Twig\Expressions\TwigExpressionMethods())', fn($arguments) => (new TwigExpressionMethods())) ]; } }