Skip to content

Commit

Permalink
Twig 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed Sep 13, 2022
1 parent f64f540 commit 1a86511
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<a name="3.1.0"></a>
# [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.

<a name="3.0.0"></a>
# [3.0.0](https://github.com/flextype-plugins/twig/compare/v2.1.0...v3.0.0) (2022-07-11)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align="center">Twig Plugin for <a href="https://awilum.github.io/flextype">Flextype</a></h1>

<p align="center">
<img src="https://img.shields.io/badge/license-MIT-blue.svg?label=License" alt="License MIT"> <img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/flextype-plugins/twig?label=Stars"> <img alt="GitHub forks" src="https://img.shields.io/github/forks/flextype-plugins/twig?label=Forks"> <a href="https://hitsofcode.com"><img alt="Hits of Code" src="https://hitsofcode.com/github/flextype-plugins/twig?branch=3.x"></a> <a href="https://discord.gg/ewQkqgfBAc"><img src="https://img.shields.io/discord/423097982498635778.svg?logo=discord&label=Discord%20Chat" alt="Discord"></a>
<img src="https://img.shields.io/badge/license-MIT-blue.svg?label=License" alt="License MIT"> <img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/flextype-plugins/twig?label=Stars"> <img alt="GitHub forks" src="https://img.shields.io/github/forks/flextype-plugins/twig?label=Forks"> <a href="https://hitsofcode.com"><img alt="Hits of Code" src="https://hitsofcode.com/github/flextype-plugins/twig?branch=3.x"></a>
</p>

Twig plugin to present Twig template engine for Flextype.
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"require": {
"php": "^8.1",
"twig/twig": "^3.4.1",
"twig/twig": "^3.4.2",
"slim/flash": "~0.4.0"
},
"config": {
Expand Down
8 changes: 4 additions & 4 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
// Register Twig Expressions
parsers()->expressions()->registerExpressions(registry()->get('plugins.twig.settings.entries.expressions'));
4 changes: 2 additions & 2 deletions plugin.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
17 changes: 17 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -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/";
1 change: 1 addition & 0 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ extensions:
- Cache
- Image
- Url
- Vars

# Twig plugin priority
priority: 0
2 changes: 1 addition & 1 deletion src/twig/core/Entries/Directives/TwigDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
36 changes: 36 additions & 0 deletions src/twig/core/Extensions/VarsTwigExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

/**
* Flextype - Hybrid Content Management System with the freedom of a headless CMS
* and with the full functionality of a traditional CMS!
*
* Copyright (c) Sergey Romanenko (https://awilum.github.io)
*
* Licensed under The MIT License.
*
* For full copyright and license information, please see the LICENSE
* Redistributions of files must retain the above copyright notice.
*/

namespace Flextype\Plugin\Twig\Extension;

use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
use function Flextype\vars;

class VarsTwigExtension extends AbstractExtension
{
/**
* Callback for twig.
*
* @return array
*/
public function getFunctions() : array
{
return [
new TwigFunction('vars', '\Flextype\vars')
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TwigExpression implements ExpressionFunctionProviderInterface
public function getFunctions()
{
return [
new ExpressionFunction('twig', fn() => '(new TwigExpressionMethods())', fn($arguments) => (new TwigExpressionMethods()))
new ExpressionFunction('twig', fn() => '(new \Flextype\Plugin\Twig\Expressions\TwigExpressionMethods())', fn($arguments) => (new TwigExpressionMethods()))
];
}
}
Expand Down

0 comments on commit 1a86511

Please sign in to comment.