@@ -55,13 +55,10 @@ By convention they are stored in the ``src/Form/Type/`` directory::
5555 }
5656 }
5757
58- The ``configureOptions() `` method, which is explained later in this article,
59- defines the options that can be configured for the form type and sets the
60- default value of those options.
61-
62- The ``getParent() `` method defines which is the form type used as the base of
63- this type. In this case, the type extends from ``ChoiceType `` to reuse all of
64- the logic and rendering of that field type.
58+ The methods of the ``FormTypeInterface `` are explained in detail later in
59+ this article. Here, ``getParent() `` method defines the base type
60+ (``ChoiceType ``) and ``configureOptions() `` overrides some of its options.
61+ The resulting form type is a choice field with predefined choices.
6562
6663.. note ::
6764
@@ -144,13 +141,27 @@ These are the most important methods that a form type class can define:
144141
145142``configureOptions() ``
146143 It defines the options configurable when using the form type, which are also
147- the options that can be used in ``buildForm() `` and ``buildView() `` methods.
144+ the options that can be used in ``buildForm() `` and ``buildView() ``
145+ methods. Options are inherited from parent types and parent type
146+ extensions, but you can create any custom option you need.
148147
149148``finishView() ``
150149 When creating a form type that consists of many fields, this method allows
151150 to modify the "view" of any of those fields. For any other use case, it's
152151 recommended to use instead the ``buildView() `` method.
153152
153+ ``getParent() ``
154+ If your custom type is based on another type (i.e. they share some
155+ functionality) add this method to return the fully-qualified class name
156+ of that original type. Do not use PHP inheritance for this.
157+ Symfony will call all the form type methods (``buildForm() ``,
158+ ``buildView() ``, etc.) of the parent type and it will call all its type
159+ extensions before calling the ones defined in your custom type.
160+
161+ By default, the ``AbstractType `` class returns the generic
162+ :class: `Symfony\\ Component\\ Form\\ Extension\\ Core\\ Type\\ FormType `
163+ type, which is the root parent for all form types in the Form component.
164+
154165Defining the Form Type
155166~~~~~~~~~~~~~~~~~~~~~~
156167
0 commit comments