Hello. I have a problem with accessing variables in my custom function.
So for example my code is:
{{ myFunction(variableFromController) }}
And PHP:
<?php
$compiler->addFunction('myFunction',function($resolvedArgs,$exprArgs)use($di,$compiler){
$arg = $compiler->expression($exprArgs[0]['expr']);
$lang = $di->get('lang');
echo $lang->translate($arg);
});
?>
So problem is that compiler will return variable as string "$variableFromController", where i'm doing it wrong ?