行和小部件之间的 Symfony 形式差异
Symfony form differences between row and widget
form_widget
和form_row
有什么区别?
我知道在 form_row
中我可以在属性中添加标签,并且 form_widget
呈现所有字段。
还有其他区别吗?
来自文档:
form_widget
Renders the HTML widget of a given field. If you apply this to an
entire form or collection of fields, each underlying form row will be
rendered.
form_row
Renders the "row" of a given field, which is the combination of the
field's label, errors and widget.
所以主要区别在于 form_widget 也会呈现子字段(如果它们存在)。
form_widget
和form_row
有什么区别?
我知道在 form_row
中我可以在属性中添加标签,并且 form_widget
呈现所有字段。
还有其他区别吗?
来自文档:
form_widget
Renders the HTML widget of a given field. If you apply this to an entire form or collection of fields, each underlying form row will be rendered.
form_row
Renders the "row" of a given field, which is the combination of the field's label, errors and widget.
所以主要区别在于 form_widget 也会呈现子字段(如果它们存在)。