Skip to content

Commit

Permalink
Merge pull request #10 from pdir/bugfix/insert-tags
Browse files Browse the repository at this point in the history
Fix theme helper insert tags
  • Loading branch information
MDevster authored Nov 18, 2024
2 parents 981c9a1 + ad13242 commit 6714140
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions contao/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
'tables' => [],
];

/**
* Register hooks
*/
$GLOBALS['TL_HOOKS']['replaceInsertTags'][] = ['theme_helper.listener.insert_tags', 'onReplaceInsertTags'];

/**
* Javascript for Backend
*/
Expand Down
21 changes: 4 additions & 17 deletions src/EventListener/InsertTagsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
*/
#[AsHook('replaceInsertTags')]
class InsertTagsListener
{
/**
Expand All @@ -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]);
Expand Down

0 comments on commit 6714140

Please sign in to comment.