Skip to content

Commit a815378

Browse files
committed
minor #5263 Let docbot review the form docs (WouterJ)
This PR was merged into the 2.3 branch. Discussion ---------- Let docbot review the form docs | Q | A | --- | --- | Doc fixes? | yes | New docs? | no | Applies to | 2.3+ | Fixed tickets | - Commits ------- 55246be Updated types articles 03fdc5b Reviewed form type options includes
2 parents 2fc4b10 + 55246be commit a815378

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+366
-315
lines changed

reference/forms/types/birthday.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ birthday Field Type
77
A :doc:`date </reference/forms/types/date>` field that specializes in handling
88
birthdate data.
99

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

1313
This type is essentially the same as the :doc:`date </reference/forms/types/date>`
@@ -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:`date </reference/forms/types/date>` type: |
2626
| | |
2727
| | - `days`_ |
2828
| | - `empty_value`_ |
@@ -62,7 +62,8 @@ 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>` type:
65+
These options inherit from the :doc:`date </reference/forms/types/date>`
66+
type:
6667

6768
.. include:: /reference/forms/types/options/days.rst.inc
6869

@@ -80,7 +81,8 @@ These options inherit from the :doc:`date </reference/forms/types/date>` type:
8081

8182
.. include:: /reference/forms/types/options/date_widget.rst.inc
8283

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

8587
.. include:: /reference/forms/types/options/data.rst.inc
8688

reference/forms/types/button.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ Inherited Options
2727

2828
The following options are defined in the
2929
:class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BaseType` class.
30-
The ``BaseType`` class is the parent class for both the ``button`` type and
31-
the :doc:`form type </reference/forms/types/form>`, but it is not part of
32-
the form type tree (i.e. it can not be used as a form type on its own).
30+
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
32+
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
3535

reference/forms/types/checkbox.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ Overridden Options
5656
Inherited Options
5757
-----------------
5858

59-
These options inherit from the :doc:`form </reference/forms/types/form>` type:
59+
These options inherit from the :doc:`form </reference/forms/types/form>`
60+
type:
6061

6162
.. include:: /reference/forms/types/options/data.rst.inc
6263

reference/forms/types/choice.rst

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ option.
4343
Example Usage
4444
-------------
4545

46-
The easiest way to use this field is to specify the choices directly via the
47-
``choices`` option. The key of the array becomes the value that's actually
46+
The easiest way to use this field is to specify the choices directly via
47+
the ``choices`` option. The key of the array becomes the value that's actually
4848
set on your underlying object (e.g. ``m``), while the value is what the
4949
user sees on the form (e.g. ``Male``).
5050

@@ -57,9 +57,7 @@ user sees on the form (e.g. ``Male``).
5757
5858
By setting ``multiple`` to true, you can allow the user to choose multiple
5959
values. The widget will be rendered as a multiple ``select`` tag or a series
60-
of checkboxes depending on the ``expanded`` option:
61-
62-
.. code-block:: php
60+
of checkboxes depending on the ``expanded`` option::
6361

6462
$builder->add('availability', 'choice', array(
6563
'choices' => array(
@@ -70,8 +68,8 @@ of checkboxes depending on the ``expanded`` option:
7068
'multiple' => true,
7169
));
7270

73-
You can also use the ``choice_list`` option, which takes an object that can
74-
specify the choices for your widget.
71+
You can also use the ``choice_list`` option, which takes an object that
72+
can specify the choices for your widget.
7573

7674
.. _forms-reference-choice-tags:
7775

@@ -95,11 +93,11 @@ is the item value and the array value is the item's label::
9593

9694
.. tip::
9795

98-
When the values to choose from are not integers or strings (but e.g. floats
99-
or booleans), you should use the `choice_list`_ option instead. With this
100-
option you are able to keep the original data format which is important
101-
to ensure that the user input is validated properly and useless database
102-
updates caused by a data type mismatch are avoided.
96+
When the values to choose from are not integers or strings (but e.g.
97+
floats or booleans), you should use the `choice_list`_ option instead.
98+
With this option you are able to keep the original data format which
99+
is important to ensure that the user input is validated properly and
100+
useless database updates caused by a data type mismatch are avoided.
103101

104102
choice_list
105103
~~~~~~~~~~~
@@ -164,7 +162,8 @@ the parent field (the form in most cases).
164162
Inherited Options
165163
-----------------
166164

167-
These options inherit from the :doc:`form </reference/forms/types/form>` type:
165+
These options inherit from the :doc:`form </reference/forms/types/form>`
166+
type:
168167

169168
.. include:: /reference/forms/types/options/by_reference.rst.inc
170169

@@ -215,5 +214,5 @@ Field Variables
215214

216215
.. tip::
217216

218-
It's significantly faster to use the :ref:`form-twig-selectedchoice` test
219-
instead when using Twig.
217+
It's significantly faster to use the :ref:`form-twig-selectedchoice`
218+
test instead when using Twig.

reference/forms/types/collection.rst

Lines changed: 50 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
collection Field Type
55
=====================
66

7-
This field type is used to render a "collection" of some field or form. In
8-
the easiest sense, it could be an array of ``text`` fields that populate
7+
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
99
an array ``emails`` field. In more complex examples, you can embed entire
10-
forms, which is useful when creating forms that expose one-to-many relationships
11-
(e.g. a product from where you can manage many related product photos).
10+
forms, which is useful when creating forms that expose one-to-many
11+
relationships (e.g. a product from where you can manage many related product
12+
photos).
1213

1314
+-------------+-----------------------------------------------------------------------------+
1415
| Rendered as | depends on the `type`_ option |
@@ -45,8 +46,8 @@ forms, which is useful when creating forms that expose one-to-many relationships
4546
Basic Usage
4647
-----------
4748

48-
This type is used when you want to manage a collection of similar items in
49-
a form. For example, suppose you have an ``emails`` field that corresponds
49+
This type is used when you want to manage a collection of similar items
50+
in a form. For example, suppose you have an ``emails`` field that corresponds
5051
to an array of email addresses. In the form, you want to expose each email
5152
address as its own input text box::
5253

@@ -104,8 +105,8 @@ A much more flexible method would look like this:
104105
<?php endforeach ?>
105106
</ul>
106107

107-
In both cases, no input fields would render unless your ``emails`` data array
108-
already contained some emails.
108+
In both cases, no input fields would render unless your ``emails`` data
109+
array already contained some emails.
109110

110111
In this simple example, it's still impossible to add new addresses or remove
111112
existing addresses. Adding new addresses is possible by using the `allow_add`_
@@ -141,7 +142,11 @@ will look like this:
141142

142143
.. code-block:: html
143144

144-
<input type="email" id="form_emails___name__" name="form[emails][__name__]" value="" />
145+
<input type="email"
146+
id="form_emails___name__"
147+
name="form[emails][__name__]"
148+
value=""
149+
/>
145150

146151
By replacing ``__name__`` with some unique value (e.g. ``2``),
147152
you can build and insert new HTML fields into your form.
@@ -160,7 +165,8 @@ you need is the JavaScript:
160165
{# ... #}
161166

162167
{# store the prototype on the data-prototype attribute #}
163-
<ul id="email-fields-list" data-prototype="{{ form_widget(form.emails.vars.prototype)|e }}">
168+
<ul id="email-fields-list"
169+
data-prototype="{{ form_widget(form.emails.vars.prototype)|e }}">
164170
{% for emailField in form.emails %}
165171
<li>
166172
{{ form_errors(emailField) }}
@@ -203,10 +209,10 @@ you need is the JavaScript:
203209

204210
If you're rendering the entire collection at once, then the prototype
205211
is automatically available on the ``data-prototype`` attribute of the
206-
element (e.g. ``div`` or ``table``) that surrounds your collection. The
207-
only difference is that the entire "form row" is rendered for you, meaning
208-
you wouldn't have to wrap it in any container element as it was done
209-
above.
212+
element (e.g. ``div`` or ``table``) that surrounds your collection.
213+
The only difference is that the entire "form row" is rendered for you,
214+
meaning you wouldn't have to wrap it in any container element as it
215+
was done above.
210216

211217
Field Options
212218
-------------
@@ -222,8 +228,9 @@ items as well as the new item that was in the submitted data. See the above
222228
example for more details.
223229

224230
The `prototype`_ option can be used to help render a prototype item that
225-
can be used - with JavaScript - to create new form items dynamically on the
226-
client side. For more information, see the above example and :ref:`cookbook-form-collections-new-prototype`.
231+
can be used - with JavaScript - to create new form items dynamically on
232+
the client side. For more information, see the above example and
233+
:ref:`cookbook-form-collections-new-prototype`.
227234

228235
.. caution::
229236

@@ -249,11 +256,11 @@ For more information, see :ref:`cookbook-form-collections-remove`.
249256

250257
Be careful when using this option when you're embedding a collection
251258
of objects. In this case, if any embedded forms are removed, they *will*
252-
correctly be missing from the final array of objects. However, depending on
253-
your application logic, when one of those objects is removed, you may want
254-
to delete it or at least remove its foreign key reference to the main object.
255-
None of this is handled automatically. For more information, see
256-
:ref:`cookbook-form-collections-remove`.
259+
correctly be missing from the final array of objects. However, depending
260+
on your application logic, when one of those objects is removed, you
261+
may want to delete it or at least remove its foreign key reference to
262+
the main object. None of this is handled automatically. For more
263+
information, see :ref:`cookbook-form-collections-remove`.
257264

258265
options
259266
~~~~~~~
@@ -262,8 +269,9 @@ options
262269

263270
This is the array that's passed to the form type specified in the `type`_
264271
option. For example, if you used the :doc:`choice </reference/forms/types/choice>`
265-
type as your `type`_ option (e.g. for a collection of drop-down menus), then
266-
you'd need to at least pass the ``choices`` option to the underlying type::
272+
type as your `type`_ option (e.g. for a collection of drop-down menus),
273+
then you'd need to at least pass the ``choices`` option to the underlying
274+
type::
267275

268276
$builder->add('favorite_cities', 'collection', array(
269277
'type' => 'choice',
@@ -283,13 +291,13 @@ prototype
283291
**type**: ``boolean`` **default**: ``true``
284292

285293
This option is useful when using the `allow_add`_ option. If ``true`` (and
286-
if `allow_add`_ is also ``true``), a special "prototype" attribute will be
287-
available so that you can render a "template" example on your page of what
288-
a new element should look like. The ``name`` attribute given to this element
289-
is ``__name__``. This allows you to add a "add another" button via JavaScript
290-
which reads the prototype, replaces ``__name__`` with some unique name or
291-
number, and render it inside your form. When submitted, it will be added
292-
to your underlying array due to the `allow_add`_ option.
294+
if `allow_add`_ is also ``true``), a special "prototype" attribute will
295+
be available so that you can render a "template" example on your page of
296+
what a new element should look like. The ``name`` attribute given to this
297+
element is ``__name__``. This allows you to add a "add another" button via
298+
JavaScript which reads the prototype, replaces ``__name__`` with some unique
299+
name or number and render it inside your form. When submitted, it will
300+
be added to your underlying array due to the `allow_add`_ option.
293301

294302
The prototype field can be rendered via the ``prototype`` variable in the
295303
collection field:
@@ -313,34 +321,35 @@ rendering your form, having the entire "form row" may be easier for you.
313321
form row is automatically available on the ``data-prototype`` attribute
314322
of the element (e.g. ``div`` or ``table``) that surrounds your collection.
315323

316-
For details on how to actually use this option, see the above example as well
317-
as :ref:`cookbook-form-collections-new-prototype`.
324+
For details on how to actually use this option, see the above example as
325+
well as :ref:`cookbook-form-collections-new-prototype`.
318326

319327
prototype_name
320328
~~~~~~~~~~~~~~
321329

322330
**type**: ``String`` **default**: ``__name__``
323331

324332
If you have several collections in your form, or worse, nested collections
325-
you may want to change the placeholder so that unrelated placeholders are not
326-
replaced with the same value.
333+
you may want to change the placeholder so that unrelated placeholders are
334+
not replaced with the same value.
327335

328336
type
329337
~~~~
330338

331339
**type**: ``string`` or :class:`Symfony\\Component\\Form\\FormTypeInterface` **required**
332340

333-
This is the field type for each item in this collection (e.g. ``text``, ``choice``,
334-
etc). For example, if you have an array of email addresses, you'd use the
335-
:doc:`email </reference/forms/types/email>` type. If you want to embed
336-
a collection of some other form, create a new instance of your form type
337-
and pass it as this option.
341+
This is the field type for each item in this collection (e.g. ``text``,
342+
``choice``, etc). For example, if you have an array of email addresses,
343+
you'd use the :doc:`email </reference/forms/types/email>` type. If you want
344+
to embed a collection of some other form, create a new instance of your
345+
form type and pass it as this option.
338346

339347
Inherited Options
340348
-----------------
341349

342-
These options inherit from the :doc:`form </reference/forms/types/form>` type.
343-
Not all options are listed here - only the most applicable to this type:
350+
These options inherit from the :doc:`form </reference/forms/types/form>`
351+
type. Not all options are listed here - only the most applicable to this
352+
type:
344353

345354
.. _reference-form-types-by-reference:
346355

reference/forms/types/country.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ country Field Type
55
==================
66

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

1111
The "value" for each country is the two-letter country code.
1212

@@ -64,7 +64,8 @@ The locale is used to translate the countries names.
6464
Inherited Options
6565
-----------------
6666

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

6970
.. include:: /reference/forms/types/options/empty_value.rst.inc
7071

@@ -78,7 +79,8 @@ These options inherit from the :doc:`choice </reference/forms/types/choice>` typ
7879

7980
.. include:: /reference/forms/types/options/preferred_choices.rst.inc
8081

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

8385
.. include:: /reference/forms/types/options/data.rst.inc
8486

reference/forms/types/currency.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ currency Field Type
55
===================
66

77
The ``currency`` type is a subset of the
8-
:doc:`choice type </reference/forms/types/choice>` that allows the user to
9-
select from a large list of `3-letter ISO 4217`_ currencies.
8+
:doc:`choice type </reference/forms/types/choice>` that allows the user
9+
to select from a large list of `3-letter ISO 4217`_ currencies.
1010

1111
Unlike the ``choice`` type, you don't need to specify a ``choices`` or
12-
``choice_list`` option as the field type automatically uses a large list of
13-
currencies. You *can* specify either of these options manually, but then you
14-
should just use the ``choice`` type directly.
12+
``choice_list`` option as the field type automatically uses a large list
13+
of currencies. You *can* specify either of these options manually, but then
14+
you should just use the ``choice`` type directly.
1515

1616
+-------------+------------------------------------------------------------------------+
1717
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
@@ -56,7 +56,8 @@ The choices option defaults to all currencies.
5656
Inherited Options
5757
-----------------
5858

59-
These options inherit from the :doc:`choice</reference/forms/types/choice>` type:
59+
These options inherit from the :doc:`choice</reference/forms/types/choice>`
60+
type:
6061

6162
.. include:: /reference/forms/types/options/empty_value.rst.inc
6263

@@ -68,7 +69,8 @@ These options inherit from the :doc:`choice</reference/forms/types/choice>` type
6869

6970
.. include:: /reference/forms/types/options/preferred_choices.rst.inc
7071

71-
These options inherit from the :doc:`form</reference/forms/types/form>` type:
72+
These options inherit from the :doc:`form</reference/forms/types/form>`
73+
type:
7274

7375
.. include:: /reference/forms/types/options/data.rst.inc
7476

0 commit comments

Comments
 (0)