【发布时间】:2017-03-18 23:24:42
【问题描述】:
我想围绕我的一堆字段设置一个特殊的 div。为此,我想向表单构建器中添加一些可以在我的 form_theme 中检测到的内容,并在 div 存在时设置它。
我尝试添加
->add('field', new myCustomType(), array('inherit_data' => true, "label" => false, "required" => false, 'attr' => array("test" => "aaa")))
到表单构建器,设置自定义属性,它实际上作为属性呈现在 html 中......但我无法在表单主题中检测到它。
{{ block('widget_container_attributes') }}
只给出widget属性,而
{{ block('row_container_attributes') }}
不起作用。实际上,我很难在网上找到任何关于表单主题的blocks 中可用的变量以及如何使用它们的资源(已经很难知道如何调用块)。
我在官方网站上寻找了更多信息,here 主要是但没有任何成功......
感谢您的帮助!
【问题讨论】:
标签: symfony symfony-forms