Skip to content

Commit 1513ec3

Browse files
committed
[Form] Added explicit getParent() call in types inheritance mechanism
1 parent 15b9b9b commit 1513ec3

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

form/create_custom_field_type.rst

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,26 @@ There are three methods that are particularly important:
7171

7272
.. _form-type-methods-explanation:
7373

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+
extensions before calling the one define in this 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+
7487
``buildForm()``
7588
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 parent types and parent
91+
types extensions.
92+
Notice that this is the same method you use to setup *your* forms, and it
93+
works the same here.
7894

7995
``buildView()``
8096
This method is used to set any extra variables you'll
@@ -83,12 +99,6 @@ There are three methods that are particularly important:
8399
set) the ``multiple`` attribute on the ``select`` field. See
84100
`Creating a Template for the Field`_ for more details.
85101

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-
92102
.. tip::
93103

94104
If you're creating a field that consists of many fields, then be sure

0 commit comments

Comments
 (0)