From b7fe69cd0cdfd7ca318545582dbb23d4c2f85aff Mon Sep 17 00:00:00 2001 From: Roel van Hintum Date: Fri, 11 Oct 2019 14:34:47 +0200 Subject: [PATCH] Fixed deprecated twig extensions. --- CHANGELOG.md | 4 ++++ composer.json | 2 +- src/twigextensions/ColorExtractorTwigExtension.php | 8 +++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86f3f48..a1bc761 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 2.0.4 - 2019-10-11 +### Fixed +- Deprecated twig extensions. + ## 2.0.3 - 2019-03-20 ### Changed - Let the volume handle asset content retrieval. diff --git a/composer.json b/composer.json index 3362c10..1b60c8d 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "born05/craft-colorextractor", "description": "Extract colors from image assets in Craft CMS. Requires a field named `imageColor` on all assets of kind image (can be color or plaintext)", "type": "craft-plugin", - "version": "2.0.3", + "version": "2.0.4", "keywords": [ "craft", "cms", diff --git a/src/twigextensions/ColorExtractorTwigExtension.php b/src/twigextensions/ColorExtractorTwigExtension.php index cf40f99..372de6d 100644 --- a/src/twigextensions/ColorExtractorTwigExtension.php +++ b/src/twigextensions/ColorExtractorTwigExtension.php @@ -5,8 +5,10 @@ use born05\colorextractor\ColorExtractor; use Craft; +use Twig\Extension\AbstractExtension; +use Twig\TwigFilter; -class ColorExtractorTwigExtension extends \Twig_Extension +class ColorExtractorTwigExtension extends AbstractExtension { public function getName() { @@ -23,8 +25,8 @@ public function getName() public function getFilters() { return [ - new \Twig_SimpleFilter('colorExtractor', [$this, 'colorExtractorFilter']), - new \Twig_SimpleFilter('colorIsDark', [$this, 'colorIsDarkFilter']), + new TwigFilter('colorExtractor', [$this, 'colorExtractorFilter']), + new TwigFilter('colorIsDark', [$this, 'colorIsDarkFilter']), ]; }