We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Macro and $this

I want to use a macro, but I get an error. I have a Volt filter:

    $volt->getCompiler()->addFilter('trans', function ($resolvedArgs, $exprArgs) {
        return '$this->translator->translate(' . $resolvedArgs . ')';
    });
{{ "Something"|trans }}

The code above works fine in simple template, but doesn't work in a macro, because $this is undefined. Also in macros doesn't work some functions like "url()".

How to fix this behavior?

Phalcon 1.2.0.