@@ -67,14 +67,30 @@ check out the `ChoiceType`_ class.
67
67
extend from ``AbstractType `` is only a convenience way of implementing the
68
68
required ``FormTypeInterface ``.
69
69
70
- There are three methods that are particularly important:
70
+ There are four methods that are particularly important:
71
71
72
72
.. _form-type-methods-explanation :
73
73
74
+ ``getParent() ``
75
+ This will defined the type configuring the form before. It means all the
76
+ other other methods below will be called with this parent type and all its
77
+ type extensions before calling the ones defined in your custom type.
78
+ By default, all classes inherit the ``AbstractType `` which defines the
79
+ ``FormType `` as parent.
80
+
81
+ ``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 others that you need here.
86
+
74
87
``buildForm() ``
75
88
Each field type has a ``buildForm() `` method, which is where
76
- you configure and build any field(s). Notice that this is the same method
77
- you use to setup *your * forms, and it works the same here.
89
+ 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 types extensions.
92
+ Notice that this is the same method you use to setup *your * forms, and it
93
+ works the same here.
78
94
79
95
``buildView() ``
80
96
This method is used to set any extra variables you'll
@@ -83,16 +99,11 @@ There are three methods that are particularly important:
83
99
set) the ``multiple `` attribute on the ``select `` field. See
84
100
`Creating a Template for the Field `_ for more details.
85
101
86
- ``configureOptions() ``
87
- This defines options for your form type that
88
- can be used in ``buildForm() `` and ``buildView() ``. There are a lot of
89
- options common to all fields (see :doc: `/reference/forms/types/form `),
90
- but you can create any others that you need here.
91
-
92
102
.. tip ::
93
103
94
104
If you're creating a field that consists of many fields, then be sure
95
- to set your "parent" type as ``form `` or something that extends ``form ``.
105
+ to set your "parent" type as ``FormType::class `` or something that extends
106
+ it.
96
107
Also, if you need to modify the "view" of any of your child types from
97
108
your parent type, use the ``finishView() `` method.
98
109
0 commit comments