10000 minor #5241 [Components][Form] apply some fixes to the Form events ch… · symfony/symfony-docs@ce7eb04 · GitHub
[go: up one dir, main page]

Skip to content

Commit ce7eb04

Browse files
committed
minor #5241 [Components][Form] apply some fixes to the Form events chapter (xabbuh)
This PR was merged into the 2.3 branch. Discussion ---------- [Components][Form] apply some fixes to the Form events chapter | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | * remove serial commas * replace wrong event constant * replace reference to form events overview that did not provide any context with a more meaningful `seealso` section Commits ------- d9f7e4e apply some fixes to the Form events chapter
2 parents cbb7ea1 + d9f7e4e commit ce7eb04

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

components/form/form_events.rst

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ The ``FormEvents::PRE_SET_DATA`` event is dispatched at the beginning of the
6060
* Modify the data given during pre-population;
6161
* Modify a form depending on the pre-populated data (adding or removing fields dynamically).
6262

63-
:ref:`Form Events Information Table<component-form-event-table>`
64-
6563
=============== ========
6664
Data Type Value
6765
=============== ========
@@ -70,6 +68,11 @@ Normalized data ``null``
7068
View data ``null``
7169
=============== ========
7270

71+
.. seealso::
72+
73+
See all form events at a glance in the
74+
:ref:`Form Events Information Table <component-form-event-table>`.
75+
7376
.. caution::
7477

7578
During ``FormEvents::PRE_SET_DATA``,
@@ -95,8 +98,6 @@ The ``FormEvents::POST_SET_DATA`` event is dispatched at the end of the
9598
method. This event is mostly here for reading data after having pre-populated
9699
the form.
97100

98-
:ref:`Form Events Information Table<component-form-event-table>`
99-
100101
=============== ====================================================
101102
Data Type Value
102103
=============== ====================================================
@@ -105,6 +106,11 @@ Normalized data Model data transformed using a model transformer
105106
View data Normalized data transformed using a view transformer
106107
=============== ====================================================
107108

109+
.. seealso::
110+
111+
See all form events at a glance in the
112+
:ref:`Form Events Information Table <component-form-event-table>`.
113+
108114
.. sidebar:: ``FormEvents::POST_SET_DATA`` in the Form component
109115

110116
The ``Symfony\Component\Form\Extension\DataCollector\EventListener\DataCollectorListener``
@@ -135,8 +141,6 @@ It can be used to:
135141
* Change data from the request, before submitting the data to the form;
136142
* Add or remove form fields, before submitting the data to the form.
137143

138-
:ref:`Form Events Information Table<component-form-event-table>`
139-
140144
=============== ========================================
141145
Data Type Value
142146
=============== ========================================
@@ -145,6 +149,11 @@ Normalized data Same as in ``FormEvents::POST_SET_DATA``
145149
View data Same as in ``FormEvents::POST_SET_DATA``
146150
=============== ========================================
147151

152+
.. seealso::
153+
154+
See all form events at a glance in the
155+
:ref:`Form Events Information Table <component-form-event-table>`.
156+
148157
.. sidebar:: ``FormEvents::PRE_SUBMIT`` in the Form component
149158

150159
The ``Symfony\Component\Form\Extension\Core\EventListener\TrimListener``
@@ -163,8 +172,6 @@ transforms back the normalized data to the model and view data.
163172

164173
It can be used to change data from the normalized representation of the data.
165174

166-
:ref:`Form Events Information Table<component-form-event-table>`
167-
168175
=============== ===================================================================================
169176
Data Type Value
170177
=============== ===================================================================================
@@ -173,6 +180,11 @@ Normalized data Data from the request reverse-transformed from the request usin
173180
View data Same as in ``FormEvents::POST_SET_DATA``
174181
=============== ===================================================================================
175182

183+
.. seealso::
184+
185+
See all form events at a glance in the
186+
:ref:`Form Events Information Table <component-form-event-table>`.
187+
176188
.. caution::
177189

178190
At this point, you cannot add or remove fields to the form.
@@ -193,16 +205,19 @@ model and view data have been denormalized.
193205

194206
It can be used to fetch data after denormalization.
195207

196-
:ref:`Form Events Information Table<component-form-event-table>`
197-
198208
=============== =============================================================
199209
Data Type Value
200210
=============== =============================================================
201211
Model data Normalized data reverse-transformed using a model transformer
202-
Normalized data Same as in ``FormEvents::POST_SUBMIT``
212+
Normalized data Same as in ``FormEvents::SUBMIT``
203213
View data Normalized data transformed using a view transformer
204214
=============== =============================================================
205215

216+
.. seealso::
217+
218+
See all form events at a glance in the
219+
:ref:`Form Events Information Table <component-form-event-table>`.
220+
206221
.. caution::
207222

208223
At this point, you cannot add or remove fields to the form.
@@ -214,21 +229,21 @@ View data Normalized data transformed using a view transformer
214229
information about the forms.
215230
The ``Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener``
216231
subscribes to the ``FormEvents::POST_SUBMIT`` event in order to
217-
automatically validate the denormalized object, and update the normalized
218-
as well as the view's representations.
232+
automatically validate the denormalized object and to update the normalized
233+
representation as well as the view representations.
219234

220235
Registering Event Listeners or Event Subscribers
221236
------------------------------------------------
222237

223238
In order to be able to use Form events, you need to create an event listener
224-
or an event subscriber, and register it to an event.
239+
or an event subscriber and register it to an event.
225240

226241
The name of each of the "form" events is defined as a constant on the
227242
:class:`Symfony\\Component\\Form\\FormEvents` class.
228243
Additionally, each event callback (listener or subscriber method) is passed a
229244
single argument, which is an instance of
230245
:class:`Symfony\\Component\\Form\\FormEvent`. The event object contains a
231-
reference to the current state of the form, and the current data being
246+
reference to the current state of the form and the current data being
232247
processed.
233248

234249
.. _component-form-event-table:

0 commit comments

Comments
 (0)
0