Arty
Well-known member
I have an issue with add-on setup that I don't know how to solve.
Add-on creates several custom template tags. Those template tags are used in template modifications. Problem is, template modifications fail to apply during add-on installation because event listeners aren't working, so custom tags aren't working, so templates cannot be compiled.
To add custom tags I'm listening to app_setup event:
How do add same tags to compiler during add-on installation or uninstallation?
Or is it impossible to have add-on that creates custom tags and uses them in templates and template modifications?
Whole code is posted here: https://github.com/cyberalien/iconify_xf2
Add-on creates several custom template tags. Those template tags are used in template modifications. Problem is, template modifications fail to apply during add-on installation because event listeners aren't working, so custom tags aren't working, so templates cannot be compiled.
To add custom tags I'm listening to app_setup event:
Code:
<?php
namespace Iconify\Iconify;
use Iconify\Iconify\Template\Compiler\Tag\Icon;
use Iconify\Iconify\Template\Compiler\Tag\IconBoxRow;
class EventListener
{
public static function appSetup(\XF\App $app)
{
$compiler = $app->templateCompiler();
$templater = $app->templater();
$compiler->setTag('icon', new Icon('icon'));
$compiler->setTag('inlineicon', new Icon('inlineicon'));
$compiler->setTag('iconbox', new IconBoxRow('iconbox'));
$compiler->setTag('iconboxrow', new IconBoxRow('iconboxrow'));
$templater->setPageParam('head.js-iconify', $templater->preEscaped('<script src="//code.iconify.design/1/1.0.0-rc5/iconify.min.js"></script>'));
}
}
Or is it impossible to have add-on that creates custom tags and uses them in templates and template modifications?
Whole code is posted here: https://github.com/cyberalien/iconify_xf2