Closed jcubic closed 8 years ago
Have a look here: https://github.com/XaminProject/handlebars.php/blob/198faa48d620807541dacf84fe03a785692f1203/tests/Xamin/HandlebarsTest.php#L427
You get a Template
instance which has getSource
method.
getSource return whole template and I want to get the current helper content.
I think the source parameter is passed to helpers (third one if i can remmember correctly)
Yes this work, thanks:
$engine->addHelper('escape', function ($template, $context, $arg, $source) {
return $source;
});
I want to impement escape helper, for this to work I need to have access to text that's inside helper.
I can call
$template->getTree();
method to get the whole tree of the template but not the current helper content tree.Is there a way to get the string that's inside block helper?