Skip to content

Commit feb68dd

Browse files
committed
Completely updating the form type reference section for the text -> TextType changes
1 parent 832a12a commit feb68dd

34 files changed

+299
-324
lines changed

Diff for: reference/forms/types.rst

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
Form Types Reference
55
====================
66

7+
.. versionadded:: 2.8
8+
To denote the form type, you have to use the fully qualified class name - like
9+
``TextType::class`` in PHP 5.5+ or ``Symfony\Component\Form\Extension\Core\Type\TextType``.
10+
Before Symfony 2.8, you could use an alias for each type like ``text`` or
11+
``date``. The old alias syntax will still work until Symfony 3.0. For more details,
12+
see the `2.8 UPGRADE Log`_.
13+
714
.. toctree::
815
:maxdepth: 1
916
:hidden:
@@ -49,7 +56,7 @@ Form Types Reference
4956
types/form
5057

5158
A form is composed of *fields*, each of which are built with the help of
52-
a field *type* (e.g. a ``text`` type, ``choice`` type, etc). Symfony comes
59+
a field *type* (e.g. ``TextType``, ``ChoiceType``, etc). Symfony comes
5360
standard with a large list of field types that can be used in your application.
5461

5562
Supported Field Types

Diff for: reference/forms/types/birthday.rst

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
.. index::
2-
single: Forms; Fields; birthday
2+
single: Forms; Fields; BirthdayType
33

4-
birthday Field Type
5-
===================
4+
BirthdayType Field
5+
==================
66

7-
A :doc:`date </reference/forms/types/date>` field that specializes in handling
7+
A :doc:`DateType </reference/forms/types/date>` field that specializes in handling
88
birthdate data.
99

1010
Can be rendered as a single text box, three text boxes (month, day and year),
1111
or three select boxes.
1212

13-
This type is essentially the same as the :doc:`date </reference/forms/types/date>`
13+
This type is essentially the same as the :doc:`DateType </reference/forms/types/date>`
1414
type, but with a more appropriate default for the `years`_ option. The `years`_
1515
option defaults to 120 years ago to the current year.
1616

@@ -22,7 +22,7 @@ option defaults to 120 years ago to the current year.
2222
+----------------------+-------------------------------------------------------------------------------+
2323
| Overridden options | - `years`_ |
2424
+----------------------+-------------------------------------------------------------------------------+
25-
| Inherited options | from the :doc:`date </reference/forms/types/date>` type: |
25+
| Inherited options | from the :doc:`DateType </reference/forms/types/date>`: |
2626
| | |
2727
| | - `days`_ |
2828
| | - `placeholder`_ |
@@ -33,7 +33,7 @@ option defaults to 120 years ago to the current year.
3333
| | - `view_timezone`_ |
3434
| | - `widget`_ |
3535
| | |
36-
| | from the :doc:`form </reference/forms/types/form>` type: |
36+
| | from the :doc:`FormType </reference/forms/types/form>`: |
3737
| | |
3838
| | - `data`_ |
3939
| | - `disabled`_ |
@@ -43,7 +43,7 @@ option defaults to 120 years ago to the current year.
4343
| | - `mapped`_ |
4444
| | - `read_only`_ (deprecated as of 2.8) |
4545
+----------------------+-------------------------------------------------------------------------------+
46-
| Parent type | :doc:`date </reference/forms/types/date>` |
46+
| Parent type | :doc:`DateType </reference/forms/types/date>` |
4747
+----------------------+-------------------------------------------------------------------------------+
4848
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType` |
4949
+----------------------+-------------------------------------------------------------------------------+
@@ -62,8 +62,7 @@ relevant when the ``widget`` option is set to ``choice``.
6262
Inherited Options
6363
-----------------
6464

65-
These options inherit from the :doc:`date </reference/forms/types/date>`
66-
type:
65+
These options inherit from the :doc:`DateType </reference/forms/types/date>`:
6766

6867
.. include:: /reference/forms/types/options/days.rst.inc
6968

@@ -81,8 +80,7 @@ type:
8180

8281
.. include:: /reference/forms/types/options/date_widget.rst.inc
8382

84-
These options inherit from the :doc:`form </reference/forms/types/form>`
85-
type:
83+
These options inherit from the :doc:`FormType </reference/forms/types/form>`:
8684

8785
.. include:: /reference/forms/types/options/data.rst.inc
8886

Diff for: reference/forms/types/button.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
.. index::
2-
single: Forms; Fields; button
2+
single: Forms; Fields; ButtonType
33

4-
button Field Type
5-
=================
4+
ButtonType Field
5+
================
66

77
.. versionadded:: 2.3
8-
The ``button`` type was introduced in Symfony 2.3
8+
The ``ButtonType`` was introduced in Symfony 2.3
99

1010
A simple, non-responsive button.
1111

@@ -28,7 +28,7 @@ Inherited Options
2828
The following options are defined in the
2929
:class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BaseType` class.
3030
The ``BaseType`` class is the parent class for both the ``button`` type
31-
and the :doc:`form type </reference/forms/types/form>`, but it is not part
31+
and the :doc:`FormType </reference/forms/types/form>`, but it is not part
3232
of the form type tree (i.e. it can not be used as a form type on its own).
3333

3434
.. include:: /reference/forms/types/options/button_attr.rst.inc

Diff for: reference/forms/types/checkbox.rst

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. index::
2-
single: Forms; Fields; checkbox
2+
single: Forms; Fields; CheckboxType
33

4-
checkbox Field Type
5-
===================
4+
CheckboxType Field
5+
==================
66

77
Creates a single input checkbox. This should always be used for a field
88
that has a boolean value: if the box is checked, the field will be set to
@@ -26,7 +26,7 @@ true, if the box is unchecked, the value will be set to false.
2626
| | - `read_only`_ (deprecated as of 2.8) |
2727
| | - `required`_ |
2828
+-------------+------------------------------------------------------------------------+
29-
| Parent type | :doc:`form </reference/forms/types/form>` |
29+
| Parent type | :doc:`FormType </reference/forms/types/form>` |
3030
+-------------+------------------------------------------------------------------------+
3131
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType` |
3232
+-------------+------------------------------------------------------------------------+
@@ -59,8 +59,7 @@ Overridden Options
5959
Inherited Options
6060
-----------------
6161

62-
These options inherit from the :doc:`form </reference/forms/types/form>`
63-
type:
62+
These options inherit from the :doc:`FormType </reference/forms/types/form>`:
6463

6564
.. include:: /reference/forms/types/options/data.rst.inc
6665

Diff for: reference/forms/types/choice.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. index::
2-
single: Forms; Fields; choice
2+
single: Forms; Fields; ChoiceType
33

4-
choice Field Type (select drop-downs, radio buttons & checkboxes)
5-
=================================================================
4+
ChoiceType Field (select drop-downs, radio buttons & checkboxes)
5+
================================================================
66

77
A multi-purpose field used to allow the user to "choose" one or more options.
88
It can be rendered as a ``select`` tag, radio buttons, or checkboxes.
@@ -41,7 +41,7 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op
4141
| | - `read_only`_ (deprecated as of 2.8) |
4242
| | - `required`_ |
4343
+-------------+------------------------------------------------------------------------------+
44-
| Parent type | :doc:`form </reference/forms/types/form>` |
44+
| Parent type | :doc:`FormType </reference/forms/types/form>` |
4545
+-------------+------------------------------------------------------------------------------+
4646
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType` |
4747
+-------------+------------------------------------------------------------------------------+
@@ -91,6 +91,7 @@ this example, the underlying data is some ``Category`` object that has a ``getNa
9191
method::
9292

9393
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
94+
use AppBundle\Entity\Category;
9495
// ...
9596

9697
$builder->add('category', ChoiceType::class, [
@@ -333,8 +334,7 @@ the parent field (the form in most cases).
333334
Inherited Options
334335
-----------------
335336

336-
These options inherit from the :doc:`form </reference/forms/types/form>`
337-
type:
337+
These options inherit from the :doc:`FormType </reference/forms/types/form>`:
338338

339339
.. include:: /reference/forms/types/options/by_reference.rst.inc
340340

Diff for: reference/forms/types/collection.rst

+13-14
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.. index::
2-
single: Forms; Fields; collection
2+
single: Forms; Fields; CollectionType
33

4-
collection Field Type
5-
=====================
4+
CollectionType Field
5+
====================
66

77
This field type is used to render a "collection" of some field or form.
8-
In the easiest sense, it could be an array of ``text`` fields that populate
9-
an array ``emails`` field. In more complex examples, you can embed entire
8+
In the easiest sense, it could be an array of ``TextType`` fields that populate
9+
an array ``emails`` values. In more complex examples, you can embed entire
1010
forms, which is useful when creating forms that expose one-to-many
1111
relationships (e.g. a product from where you can manage many related product
1212
photos).
@@ -32,7 +32,7 @@ photos).
3232
| | - `mapped`_ |
3333
| | - `required`_ |
3434
+-------------+-----------------------------------------------------------------------------+
35-
| Parent type | :doc:`form </reference/forms/types/form>` |
35+
| Parent type | :doc:`FormType </reference/forms/types/form>` |
3636
+-------------+-----------------------------------------------------------------------------+
3737
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType` |
3838
+-------------+-----------------------------------------------------------------------------+
@@ -287,8 +287,8 @@ entry_options
287287
**type**: ``array`` **default**: ``array()``
288288

289289
This is the array that's passed to the form type specified in the `entry_type`_
290-
option. For example, if you used the :doc:`choice </reference/forms/types/choice>`
291-
type as your `entry_type`_ option (e.g. for a collection of drop-down menus),
290+
option. For example, if you used the :doc:`ChoiceType </reference/forms/types/choice>`
291+
as your `entry_type`_ option (e.g. for a collection of drop-down menus),
292292
then you'd need to at least pass the ``choices`` option to the underlying
293293
type::
294294

@@ -317,9 +317,9 @@ entry_type
317317

318318
**type**: ``string`` or :class:`Symfony\\Component\\Form\\FormTypeInterface` **required**
319319

320-
This is the field type for each item in this collection (e.g. ``text``,
321-
``choice``, etc). For example, if you have an array of email addresses,
322-
you'd use the :doc:`email </reference/forms/types/email>` type. If you want
320+
This is the field type for each item in this collection (e.g. ``TextType``,
321+
``ChoiceType``, etc). For example, if you have an array of email addresses,
322+
you'd use the :doc:`EmailType </reference/forms/types/email>`. If you want
323323
to embed a collection of some other form, create a new instance of your
324324
form type and pass it as this option.
325325

@@ -374,9 +374,8 @@ not replaced with the same value.
374374
Inherited Options
375375
-----------------
376376

377-
These options inherit from the :doc:`form </reference/forms/types/form>`
378-
type. Not all options are listed here - only the most applicable to this
379-
type:
377+
These options inherit from the :doc:`FormType </reference/forms/types/form>`.
378+
Not all options are listed here - only the most applicable to this type:
380379

381380
.. _reference-form-types-by-reference:
382381

Diff for: reference/forms/types/country.rst

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
.. index::
22
single: Forms; Fields; country
33

4-
country Field Type
5-
==================
4+
CountryType Field
5+
=================
66

7-
The ``country`` type is a subset of the ``ChoiceType`` that displays countries
7+
The ``CountryType`` is a subset of the ``ChoiceType`` that displays countries
88
of the world. As an added bonus, the country names are displayed in the
99
language of the user.
1010

@@ -14,18 +14,17 @@ The "value" for each country is the two-letter country code.
1414

1515
The locale of your user is guessed using :phpmethod:`Locale::getDefault`
1616

17-
Unlike the ``choice`` type, you don't need to specify a ``choices`` or
18-
``choice_list`` option as the field type automatically uses all of the countries
19-
of the world. You *can* specify either of these options manually, but then
20-
you should just use the ``choice`` type directly.
17+
Unlike the ``ChoiceType``, you don't need to specify a ``choices`` option as the
18+
field type automatically uses all of the countries of the world. You *can* specify
19+
the option manually, but then you should just use the ``ChoiceType`` directly.
2120

2221
+-------------+-----------------------------------------------------------------------+
2322
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
2423
+-------------+-----------------------------------------------------------------------+
2524
| Overridden | - `choices`_ |
2625
| options | |
2726
+-------------+-----------------------------------------------------------------------+
28-
| Inherited | from the :doc:`choice </reference/forms/types/choice>` type |
27+
| Inherited | from the :doc:`ChoiceType </reference/forms/types/choice>` |
2928
| options | |
3029
| | - `placeholder`_ |
3130
| | - `error_bubbling`_ |
@@ -34,7 +33,7 @@ you should just use the ``choice`` type directly.
3433
| | - `multiple`_ |
3534
| | - `preferred_choices`_ |
3635
| | |
37-
| | from the :doc:`form </reference/forms/types/form>` type |
36+
| | from the :doc:`FormType </reference/forms/types/form>` |
3837
| | |
3938
| | - `data`_ |
4039
| | - `disabled`_ |
@@ -45,7 +44,7 @@ you should just use the ``choice`` type directly.
4544
| | - `read_only`_ (deprecated as of 2.8) |
4645
| | - `required`_ |
4746
+-------------+-----------------------------------------------------------------------+
48-
| Parent type | :doc:`choice </reference/forms/types/choice>` |
47+
| Parent type | :doc:`ChoiceType </reference/forms/types/choice>` |
4948
+-------------+-----------------------------------------------------------------------+
5049
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CountryType` |
5150
+-------------+-----------------------------------------------------------------------+
@@ -64,8 +63,7 @@ The locale is used to translate the countries names.
6463
Inherited Options
6564
-----------------
6665

67-
These options inherit from the :doc:`choice </reference/forms/types/choice>`
68-
type:
66+
These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`:
6967

7068
.. include:: /reference/forms/types/options/placeholder.rst.inc
7169

@@ -79,8 +77,7 @@ type:
7977

8078
.. include:: /reference/forms/types/options/preferred_choices.rst.inc
8179

82-
These options inherit from the :doc:`form </reference/forms/types/form>`
83-
type:
80+
These options inherit from the :doc:`FormType </reference/forms/types/form>`:
8481

8582
.. include:: /reference/forms/types/options/data.rst.inc
8683

0 commit comments

Comments
 (0)