I have a problem with inserting dynamic variables into custom volt functions.
For example i have a code:
{{ myFunction(variableFromController) }}
And accessing the variable:
$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 returns a variable as string "$variableFromController", so i cannot acccess content from variable.
Do you know how to pass variable correct into custom function or is a problem in accessing ?
Thanks.