Skip to content

Commit 2d7f03b

Browse files
Korbeiljaviereguiluz
authored andcommitted
Consistency in form widget names
1 parent 2b13d08 commit 2d7f03b

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

form/create_custom_field_type.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ of the type in one of your forms::
263263
{
264264
public function buildForm(FormBuilderInterface $builder, array $options)
265265
{
266-
$builder->add('shipping_code', ShippingType::class, [
266+
$builder->add('shippingCode', ShippingType::class, [
267267
'placeholder' => 'Choose a delivery option',
268268
]);
269269
}

form/events.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

reference/forms/types/collection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ type::
308308
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
309309
// ...
310310

311-
$builder->add('favorite_cities', CollectionType::class, [
311+
$builder->add('favoriteCities', CollectionType::class, [
312312
'entry_type' => ChoiceType::class,
313313
'entry_options' => [
314314
'choices' => [

reference/forms/types/options/date_format.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For more information on valid formats, see `Date/Time Format Syntax`_::
1616
use Symfony\Component\Form\Extension\Core\Type\DateType;
1717
// ...
1818

19-
$builder->add('date_created', DateType::class, [
19+
$builder->add('dateCreated', DateType::class, [
2020
'widget' => 'single_text',
2121
// this is actually the default format for single_text
2222
'format' => 'yyyy-MM-dd',

reference/forms/types/options/invalid_message_parameters.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ When setting the ``invalid_message`` option, you may need to
77
include some variables in the string. This can be done by adding placeholders
88
to that option and including the variables in this option::
99

10-
$builder->add('some_field', SomeFormType::class, [
10+
$builder->add('someField', SomeFormType::class, [
1111
// ...
1212
'invalid_message' => 'You entered an invalid value, it should include %num% letters',
1313
'invalid_message_parameters' => ['%num%' => 6],

0 commit comments

Comments
 (0)