You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.. _`override the location of the main directories`: http://symfony.com/doc/current/cookbook/configuration/override_dir_structure.html
Copy file name to clipboardExpand all lines: best_practices/forms.rst
+6-9
Original file line number
Diff line number
Diff line change
@@ -69,9 +69,11 @@ To use the class, use ``createForm`` and instantiate the new class:
69
69
Registering Forms as Services
70
70
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71
71
72
-
You can also `register your form type as a service`_. But this is *not* recommended
73
-
unless you plan to reuse the new form type in many places or embed it in
74
-
other forms directly or via the `collection type`_.
72
+
You can also
73
+
:ref:`register your form type as a service <form-cookbook-form-field-service>`.
74
+
But this is *not* recommended unless you plan to reuse the new form type in many
75
+
places or embed it in other forms directly or via the
76
+
:doc:`collection type </reference/forms/types/collection>`.
75
77
76
78
For most forms that are used only to edit or create something, registering
77
79
the form as a service is over-kill, and makes it more difficult to figure
@@ -169,7 +171,7 @@ fields:
169
171
170
172
If you need more control over how your fields are rendered, then you should
171
173
remove the ``form_widget(form)`` function and render your fields individually.
172
-
See `How to Customize Form Rendering`_ for more information on this and how
174
+
See :doc:`/cookbook/form/form_customization` for more information on this and how
173
175
you can control *how* the form renders at a global level using form theming.
174
176
175
177
Handling Form Submits
@@ -210,8 +212,3 @@ Second, we recommend using ``$form->isSubmitted()`` in the ``if`` statement
210
212
for clarity. This isn't technically needed, since ``isValid()`` first calls
211
213
``isSubmitted()``. But without this, the flow doesn't read well as it *looks*
212
214
like the form is *always* processed (even on the GET request).
213
-
214
-
.. _`register your form type as a service`: http://symfony.com/doc/current/cookbook/form/create_custom_field_type.html#creating-your-field-type-as-a-service
.. _`render a template without using a controller`: http://symfony.com/doc/current/cookbook/templating/render_without_controller.html
0 commit comments