Closed randohinn closed 6 years ago
Probably you found the answer, but anyway.
You're doing it in the wrong order. And registerTag
wants a class name, not an instance.
class EntypoTag extends AbstractTag {
public function render(Context $context) {
return "OK!";
}
}
$template = new Template();
$template->registerTag('entypo', EntypoTag::class);
$template->parse('{% entypo %}');
echo $template->render();
Title says it all. I want to add a new tag, callable by {% entypo %} and I can't figure out how to register a
AbstractTag
. Here's the tag:And here is how I'm registering it so far:
And bam, I get a
Unkown tag entypo [E:\Webdev\CMS\vendor\liquid\liquid\src\Liquid\AbstractBlock.php:146]
. How can I propely register it?