douhuanglou1445 2012-06-23 21:37
浏览 59
已采纳

Symfony 2:在表单构建器中使用Twig扩展

I need to change the way a value or label is formatted with a custom filter. However, I need to do this from the form builder rather than in the twig template itself. In other words, when I build my form in the abstract type class, I need to be able to apply specific formatting.

Here is one application where this is needed:

Labels assigned to form elements are based on the database table field names. I need to be able to change how those labels are rendered, such as title case, or upper case, etc.

What's the best way of doing this?

Thanks!

  • 写回答

1条回答 默认 最新

  • drvkf88226 2012-06-24 05:18
    关注

    You can create a custom form field type, that extend from choice or entity field type. Then you can customize the template for the field applying filters or whatever you want.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程