Skip to content

Commit c872b5d

Browse files
committed
apply some fixes to the Form events chapter
* 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
1 parent fa90e24 commit c872b5d

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
@@ -59,8 +59,6 @@ The ``FormEvents::PRE_SET_DATA`` event is dispatched at the beginning of the
5959
* Modify the data given during pre-population;
6060
* Modify a form depending on the pre-populated data (adding or removing fields dynamically).
6161

62-
:ref:`Form Events Information Table<component-form-event-table>`
63-
6462
=============== ========
6563
Data Type Value
6664
=============== ========
@@ -69,6 +67,11 @@ Normalized data ``null``
6967
View data ``null``
7068
=============== ========
7169

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

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

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

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

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

137-
:ref:`Form Events Information Table<component-form-event-table>`
138-
139143
=============== ========================================
140144
Data Type Value
141145
=============== ========================================
@@ -144,6 +148,11 @@ Normalized data Same as in ``FormEvents::POST_SET_DATA``
144148
View data Same as in ``FormEvents::POST_SET_DATA``
145149
=============== ========================================
146150

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

149158
The ``Symfony\Component\Form\Extension\Core\EventListener\TrimListener``
@@ -162,8 +171,6 @@ transforms back the normalized data to the model and view data.
162171

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

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

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

177189
At this point, you cannot add or remove fields to the form.
@@ -192,16 +204,19 @@ model and view data have been denormalized.
192204

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

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

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

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

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

222237
In order to be able to use Form events, you need to create an event listener
223-
or an event subscriber, and register it to an event.
238+
or an event subscriber and register it to an event.
224239

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

233248
.. _component-form-event-table:

0 commit comments

Comments
 (0)