How to var_dump variables in twig templates?

后端 未结 14 1490
滥情空心
滥情空心 2020-12-22 17:43

View layer pattern where you only present what you have been given is fine and all, but how do you know what is available? Is there a \"list all defined variables\" function

14条回答
  •  遥遥无期
    2020-12-22 18:08

    {{ dump() }} doesn't work for me. PHP chokes. Nesting level too deep I guess.

    All you really need to debug Twig templates if you're using a debugger is an extension like this.

    Then it's just a matter of setting a breakpoint and calling {{ inspect() }} wherever you need it. You get the same info as with {{ dump() }} but in your debugger.

提交回复
热议问题