{% set admin = true %}
{% extends admin ? "AcmeAdminBundle::admin.html.twig" : "AcmeUserBundle::user.html.twig" %}
{% form_theme form _self %}
//custom stuff
<form action="{{ path('process_form')}}" method="post" {{ form_enctype(form) }}>
//...whatever
</form>
看起来{% form_theme form _self %}
删除了全局变量,因为我收到以下错误:
“Variable "admin" does not exist
”
在这种情况下,我该如何正确扩展模板......?