From ad13242892d029f5be9044f222d0b7e7ffd292d8 Mon Sep 17 00:00:00 2001 From: Philipp Seibt Date: Mon, 18 Nov 2024 14:16:46 +0100 Subject: [PATCH] Fix theme helper insert tags --- CHANGELOG.md | 4 ++++ contao/config/config.php | 5 ----- src/EventListener/InsertTagsListener.php | 21 ++++----------------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de18376..a698565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ Types of changes Security in case of vulnerabilities. ) +## [1.5.4](https://github.com/pdir/contao-theme-helper-bundle/tree/1.5.4) – 2024-11-18 + +- [Fixed] Fix theme helper insert tags + ## [1.5.3](https://github.com/pdir/contao-theme-helper-bundle/tree/1.5.3) – 2024-11-16 - [Fixed] Use local CSS preprocessors diff --git a/contao/config/config.php b/contao/config/config.php index 90df291..f6a1b1a 100644 --- a/contao/config/config.php +++ b/contao/config/config.php @@ -29,11 +29,6 @@ 'tables' => [], ]; -/** - * Register hooks - */ -$GLOBALS['TL_HOOKS']['replaceInsertTags'][] = ['theme_helper.listener.insert_tags', 'onReplaceInsertTags']; - /** * Javascript for Backend */ diff --git a/src/EventListener/InsertTagsListener.php b/src/EventListener/InsertTagsListener.php index 8726fb2..157d5c3 100644 --- a/src/EventListener/InsertTagsListener.php +++ b/src/EventListener/InsertTagsListener.php @@ -20,16 +20,12 @@ use Contao\ArticleModel; use Contao\ContentElement; +use Contao\CoreBundle\DependencyInjection\Attribute\AsHook; use Contao\CoreBundle\Framework\ContaoFramework; use Contao\Events; use Contao\StringUtil; -/** - * Handles insert tags for themes. - * - * @Hook("replaceInsertTags") - * @author Mathias Arzberger - */ +#[AsHook('replaceInsertTags')] class InsertTagsListener { /** @@ -54,18 +50,9 @@ public function __construct(ContaoFramework $framework) $this->framework = $framework; } - public function __invoke( - string $insertTag, - bool $useCache, - string $cachedValue, - array $flags, - array $tags, - array $cache, - int $_rit, - int $_cnt - ) + public function __invoke(string $tag) { - $elements = \explode('::', $insertTag); + $elements = \explode('::', $tag); $key = \strtolower($elements[0]); if (\in_array($key, $this->supportedTags, true)) { return $this->replaceThemeInsertTag($elements[1], $elements[2]);