PHP Twig: access current template variable from within macro without passing?
Is it possible to access the cu开发者_Python百科rrent template's variables from within a macro without passing the variable to the macro directly? Thanks.
It's possible to pass all context variables to a macro:
{{ macro(_context) }}
_context
is a special variable, which contains all currently defined variables (by name => value).
精彩评论