@@ -72,23 +72,24 @@ There are a few methods that are particularly important:
72
72
.. _form-type-methods-explanation :
73
73
74
74
``getParent() ``
75
- This will define the type configuring the form before. It means all the
76
- other methods below will be called with this parent type and all its type
77
- extensions before calling the ones defined in your custom type.
78
- By default, all classes extend the ``AbstractType `` which defines the
79
- ``FormType `` as its parent type.
75
+ This return the class name of the type configuring the form before. It
76
+ means all the other methods below will be called with this parent type
77
+ and all its type extensions before calling the ones defined in your
78
+ custom type.
79
+ By default, all classes inherit the ``AbstractType::getParent() `` which
80
+ defines the ``FormType `` as parent type to re-use its options and
81
+ configuration.
80
82
81
83
``configureOptions() ``
82
- This defines options for your form type that
83
- can be used in ``buildForm() `` and ``buildView() ``. There are a lot of
84
- options common to all fields (see :doc: ` /reference/forms/ types/form `),
85
- but you can create any custom option you need.
84
+ This defines options for your type that
85
+ can be used in ``buildForm() `` and ``buildView() ``. Options are inherited
86
+ from parent types and parent types extension but you can create any custom
87
+ option you need.
86
88
87
89
``buildForm() ``
88
90
Each field type has a ``buildForm() `` method, which is where
89
91
you configure and build any field(s) depending on options defined in
90
- ``configureOptions() `` as well as those defined in parent types and
91
- their type extensions.
92
+ ``configureOptions() ``.
92
93
Notice that this is the same method you use to set up *your * forms, and it
93
94
works the same here.
94
95
@@ -99,13 +100,14 @@ There are a few methods that are particularly important:
99
100
set) the ``multiple `` attribute on the ``select `` field. See
100
101
`Creating a Template for the Field `_ for more details.
101
102
103
+ ``finishView ``
104
+ Same as ``buildView `` but to configure the nested field views.
105
+ This method as no use with types that build compound forms.
106
+
102
107
.. tip ::
103
108
104
- If you're creating a field that consists of many fields, then be sure
105
- to set your "parent" type as ``FormType::class `` or something that extends
106
- it.
107
- Also, if you need to modify the "view" of any of your child types from
108
- your parent type, use the ``finishView() `` method.
109
+ If you're creating a field that consists of nested fields, then be sure to
110
+ set the parent type as ``FormType::class `` or one of its child.
109
111
110
112
The goal of this field was to extend the choice type to enable selection of the
111
113
shipping type. This is achieved by fixing the ``choices `` to a list of available
0 commit comments