@@ -275,7 +275,7 @@ Creating and binding an event listener to the form::
275275
276276 $form = $formFactory->createBuilder()
277277 ->add('username', TextType::class)
278- ->add('show_email ', CheckboxType::class)
278+ ->add('showEmail ', CheckboxType::class)
279279 ->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
280280 $user = $event->getData();
281281 $form = $event->getForm();
@@ -287,7 +287,7 @@ Creating and binding an event listener to the form::
287287 // checks whether the user has chosen to display their email or not.
288288 // If the data was submitted previously, the additional value that is
289289 // included in the request variables needs to be removed.
290- if (true === $user['show_email ']) {
290+ if (true === $user['showEmail ']) {
291291 $form->add('email', EmailType::class);
292292 } else {
293293 unset($user['email']);
@@ -316,7 +316,7 @@ callback for better readability::
316316 {
317317 $builder
318318 ->add('username', TextType::class)
319- ->add('show_email ', CheckboxType::class)
319+ ->add('showEmail ', CheckboxType::class)
320320 ->addEventListener(
321321 FormEvents::PRE_SET_DATA,
322322 [$this, 'onPreSetData']
@@ -383,7 +383,7 @@ Consider the following example of a form event subscriber::
383383 // checks whether the user has chosen to display their email or not.
384384 // If the data was submitted previously, the additional value that
385385 // is included in the request variables needs to be removed.
386- if (true === $user['show_email ']) {
386+ if (true === $user['showEmail ']) {
387387 $form->add('email', EmailType::class);
388388 } else {
389389 unset($user['email']);
@@ -402,7 +402,7 @@ To register the event subscriber, use the ``addEventSubscriber()`` method::
402402
403403 $form = $formFactory->createBuilder()
404404 ->add('username', TextType::class)
405- ->add('show_email ', CheckboxType::class)
405+ ->add('showEmail ', CheckboxType::class)
406406 ->addEventSubscriber(new AddEmailFieldListener())
407407 ->getForm();
408408
0 commit comments