开发者

PHP Twig: access current template variable from within macro without passing?

开发者 https://www.devze.com 2023-04-08 21:01 出处:网络
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

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消