简体   繁体   English

Symfony 2.3中的表单字段属性

[英]Form field attributes in Symfony 2.3

It was possible in Symfony 2.2 to access form field attributes in template this way: 在Symfony 2.2中,可以通过以下方式在模板中访问表单字段属性:

<?php $form['field_name']->get('field_attribute') ?>

How can i do this in Symfony 2.3? 我如何在Symfony 2.3中做到这一点? FormView object doesn't have this function any more. FormView对象不再具有此功能。

Edit : 编辑:

Indeed the FormView no longers has get function instead you have : 实际上,FormView不再具有get函数,而是具有:

array $vars The variables assigned to this view. 

The similar in twig : {{ form.task.vars.full_name }} 树枝中的类似内容: {{ form.task.vars.full_name }}

The PHP snippet on the documentation seems outdated 该文档上的PHP代码段似乎已过时

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM