我想要做的是获取存储在表单视图中的变量.
{% form_theme edit_form _self %}
{% block field_widget %}
{% spaceless %}
{% set type = type|default('text') %}
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
{# MY CODE #}
{% if type == "file" %}
<a class="BOpreview" href="{# NEED TO REPLACE VAR HERE #}">Aperçu</a>
{% endif %}
{# MY ATTEMPT #}
{{ form.title.get('value') }}
{{ form.vars.value.url }}
{% endspaceless %}
{% endblock field_widget %}
Run Code Online (Sandbox Code Playgroud)
我的表单有url,title等属性,我试图在这里访问它们以在字段widget块中使用它.
我搜索了它,并发布了https://groups.google.com/forum/?fromgroups=#!topic/symfony2/onor9uFte9E …