Skip to content

Commit 5bdf708

Browse files
Mathieu Piotjaviereguiluz
authored andcommitted
Add help option to FormType
1 parent 4fb19c2 commit 5bdf708

36 files changed

+125
-0
lines changed

form/form_customization.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ You can also render each of the three parts of the field individually:
3636
{{ form_label(form.age) }}
3737
{{ form_errors(form.age) }}
3838
{{ form_widget(form.age) }}
39+
{{ form_help(form.age) }}
3940
</div>
4041

4142
.. code-block:: php
@@ -796,6 +797,7 @@ You can also override the markup for an entire field row using the same method:
796797
{{ form_label(form) }}
797798
{{ form_errors(form) }}
798799
{{ form_widget(form) }}
800+
{{ form_help(form) }}
799801
</div>
800802
{% endblock %}
801803

@@ -1024,6 +1026,7 @@ class to the ``div`` element around each row:
10241026
{{ form_label(form) }}
10251027
{{ form_errors(form) }}
10261028
{{ form_widget(form) }}
1029+
{{ form_help(form) }}
10271030
</div>
10281031
{% endblock form_row %}
10291032

form/form_themes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ do this, create a new template file that will store the new markup:
3535
{{ form_label(form) }}
3636
{{ form_errors(form) }}
3737
{{ form_widget(form) }}
38+
{{ form_help(form) }}
3839
</div>
3940
{% endspaceless %}
4041
{% endblock form_row %}
@@ -135,6 +136,8 @@ are 4 possible *parts* of a form that can be rendered:
135136
+-------------+----------------------------+---------------------------------------------------------+
136137
| ``errors`` | (e.g. ``form_errors()``) | renders the field's errors |
137138
+-------------+----------------------------+---------------------------------------------------------+
139+
| ``help`` | (e.g. ``form_help()``) | renders the field's help |
140+
+-------------+----------------------------+---------------------------------------------------------+
138141
| ``row`` | (e.g. ``form_row()``) | renders the field's entire row (label, widget & errors) |
139142
+-------------+----------------------------+---------------------------------------------------------+
140143

form/rendering.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,14 @@ used the ``form_row()`` helper:
8282
{{ form_label(form.task) }}
8383
{{ form_errors(form.task) }}
8484
{{ form_widget(form.task) }}
85+
{{ form_help(form.task) }}
8586
</div>
8687

8788
<div>
8889
{{ form_label(form.dueDate) }}
8990
{{ form_errors(form.dueDate) }}
9091
{{ form_widget(form.dueDate) }}
92+
{{ form_help(form.dueDate) }}
9193
</div>
9294

9395
<div>

reference/forms/types/birthday.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ option defaults to 120 years ago to the current year.
3838
| | |
3939
| | - `data`_ |
4040
| | - `disabled`_ |
41+
| | - `help`_ |
4142
| | - `inherit_data`_ |
4243
| | - `invalid_message`_ |
4344
| | - `invalid_message_parameters`_ |
@@ -108,6 +109,8 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
108109

109110
.. include:: /reference/forms/types/options/disabled.rst.inc
110111

112+
.. include:: /reference/forms/types/options/help.rst.inc
113+
111114
.. include:: /reference/forms/types/options/inherit_data.rst.inc
112115

113116
.. include:: /reference/forms/types/options/invalid_message.rst.inc

reference/forms/types/checkbox.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ true, if the box is unchecked, the value will be set to false.
2020
| options | - `disabled`_ |
2121
| | - `error_bubbling`_ |
2222
| | - `error_mapping`_ |
23+
| | - `help`_ |
2324
| | - `label`_ |
2425
| | - `label_attr`_ |
2526
| | - `label_format`_ |
@@ -69,6 +70,8 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
6970

7071
.. include:: /reference/forms/types/options/error_mapping.rst.inc
7172

73+
.. include:: /reference/forms/types/options/help.rst.inc
74+
7275
.. include:: /reference/forms/types/options/label.rst.inc
7376

7477
.. include:: /reference/forms/types/options/label_attr.rst.inc

reference/forms/types/choice.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op
3434
| | - `data`_ |
3535
| | - `disabled`_ |
3636
| | - `error_mapping`_ |
37+
| | - `help`_ |
3738
| | - `inherit_data`_ |
3839
| | - `label`_ |
3940
| | - `label_attr`_ |
@@ -264,6 +265,8 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
264265

265266
.. include:: /reference/forms/types/options/error_mapping.rst.inc
266267

268+
.. include:: /reference/forms/types/options/help.rst.inc
269+
267270
.. include:: /reference/forms/types/options/inherit_data.rst.inc
268271

269272
.. include:: /reference/forms/types/options/label.rst.inc

reference/forms/types/collection.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ photos).
2727
| options | - `empty_data`_ |
2828
| | - `error_bubbling`_ |
2929
| | - `error_mapping`_ |
30+
| | - `help`_ |
3031
| | - `label`_ |
3132
| | - `label_attr`_ |
3233
| | - `label_format`_ |
@@ -448,6 +449,8 @@ error_bubbling
448449

449450
.. include:: /reference/forms/types/options/error_mapping.rst.inc
450451

452+
.. include:: /reference/forms/types/options/help.rst.inc
453+
451454
.. include:: /reference/forms/types/options/label.rst.inc
452455

453456
.. include:: /reference/forms/types/options/label_attr.rst.inc

reference/forms/types/color.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ element.
2222
| | - `empty_data`_ |
2323
| | - `error_bubbling`_ |
2424
| | - `error_mapping`_ |
25+
| | - `help`_ |
2526
| | - `label`_ |
2627
| | - `label_attr`_ |
2728
| | - `label_format`_ |
@@ -55,6 +56,8 @@ The default value is ``''`` (the empty string).
5556

5657
.. include:: /reference/forms/types/options/error_mapping.rst.inc
5758

59+
.. include:: /reference/forms/types/options/help.rst.inc
60+
5861
.. include:: /reference/forms/types/options/label.rst.inc
5962

6063
.. include:: /reference/forms/types/options/label_attr.rst.inc

reference/forms/types/country.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ the option manually, but then you should just use the ``ChoiceType`` directly.
3838
| | - `data`_ |
3939
| | - `disabled`_ |
4040
| | - `empty_data`_ |
41+
| | - `help`_ |
4142
| | - `label`_ |
4243
| | - `label_attr`_ |
4344
| | - `label_format`_ |
@@ -100,6 +101,8 @@ The actual default value of this option depends on other field options:
100101
.. include:: /reference/forms/types/options/empty_data.rst.inc
101102
:start-after: DEFAULT_PLACEHOLDER
102103

104+
.. include:: /reference/forms/types/options/help.rst.inc
105+
103106
.. include:: /reference/forms/types/options/label.rst.inc
104107

105108
.. include:: /reference/forms/types/options/label_attr.rst.inc

reference/forms/types/currency.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ manually, but then you should just use the ``ChoiceType`` directly.
3030
| | - `data`_ |
3131
| | - `disabled`_ |
3232
| | - `empty_data`_ |
33+
| | - `help`_ |
3334
| | - `label`_ |
3435
| | - `label_attr`_ |
3536
| | - `label_format`_ |
@@ -89,6 +90,8 @@ The actual default value of this option depends on other field options:
8990
.. include:: /reference/forms/types/options/empty_data.rst.inc
9091
:start-after: DEFAULT_PLACEHOLDER
9192

93+
.. include:: /reference/forms/types/options/help.rst.inc
94+
9295
.. include:: /reference/forms/types/options/label.rst.inc
9396

9497
.. include:: /reference/forms/types/options/label_attr.rst.inc

reference/forms/types/date.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ and can understand a number of different input formats via the `input`_ option.
3535
| Inherited | - `data`_ |
3636
| options | - `disabled`_ |
3737
| | - `error_mapping`_ |
38+
| | - `help`_ |
3839
| | - `inherit_data`_ |
3940
| | - `invalid_message`_ |
4041
| | - `invalid_message_parameters`_ |
@@ -206,6 +207,8 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
206207

207208
.. include:: /reference/forms/types/options/error_mapping.rst.inc
208209

210+
.. include:: /reference/forms/types/options/help.rst.inc
211+
209212
.. include:: /reference/forms/types/options/inherit_data.rst.inc
210213

211214
.. include:: /reference/forms/types/options/invalid_message.rst.inc

reference/forms/types/dateinterval.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ or an array (see `input`_).
3939
+----------------------+----------------------------------------------------------------------------------+
4040
| Inherited | - `data`_ |
4141
| options | - `disabled`_ |
42+
| | - `help`_ |
4243
| | - `inherit_data`_ |
4344
| | - `invalid_message`_ |
4445
| | - `invalid_message_parameters`_ |
@@ -307,6 +308,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
307308

308309
.. include:: /reference/forms/types/options/disabled.rst.inc
309310

311+
.. include:: /reference/forms/types/options/help.rst.inc
312+
310313
.. include:: /reference/forms/types/options/inherit_data.rst.inc
311314

312315
.. include:: /reference/forms/types/options/invalid_message.rst.inc

reference/forms/types/datetime.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array.
4242
+----------------------+-----------------------------------------------------------------------------+
4343
| Inherited | - `data`_ |
4444
| options | - `disabled`_ |
45+
| | - `help`_ |
4546
| | - `inherit_data`_ |
4647
| | - `invalid_message`_ |
4748
| | - `invalid_message_parameters`_ |
@@ -194,6 +195,8 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
194195

195196
.. include:: /reference/forms/types/options/disabled.rst.inc
196197

198+
.. include:: /reference/forms/types/options/help.rst.inc
199+
197200
.. include:: /reference/forms/types/options/inherit_data.rst.inc
198201

199202
.. include:: /reference/forms/types/options/invalid_message.rst.inc

reference/forms/types/email.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The ``EmailType`` field is a text field that is rendered using the HTML5
1515
| | - `empty_data`_ |
1616
| | - `error_bubbling`_ |
1717
| | - `error_mapping`_ |
18+
| | - `help`_ |
1819
| | - `label`_ |
1920
| | - `label_attr`_ |
2021
| | - `label_format`_ |
@@ -48,6 +49,8 @@ The default value is ``''`` (the empty string).
4849

4950
.. include:: /reference/forms/types/options/error_mapping.rst.inc
5051

52+
.. include:: /reference/forms/types/options/help.rst.inc
53+
5154
.. include:: /reference/forms/types/options/label.rst.inc
5255

5356
.. include:: /reference/forms/types/options/label_attr.rst.inc

reference/forms/types/entity.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ objects from the database.
4040
| | - `empty_data`_ |
4141
| | - `error_bubbling`_ |
4242
| | - `error_mapping`_ |
43+
| | - `help`_ |
4344
| | - `label`_ |
4445
| | - `label_attr`_ |
4546
| | - `label_format`_ |
@@ -303,6 +304,8 @@ The actual default value of this option depends on other field options:
303304

304305
.. include:: /reference/forms/types/options/error_mapping.rst.inc
305306

307+
.. include:: /reference/forms/types/options/help.rst.inc
308+
306309
.. include:: /reference/forms/types/options/label.rst.inc
307310

308311
.. include:: /reference/forms/types/options/label_attr.rst.inc

reference/forms/types/file.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The ``FileType`` represents a file input in your form.
1818
| Inherited | - `disabled`_ |
1919
| options | - `error_bubbling`_ |
2020
| | - `error_mapping`_ |
21+
| | - `help`_ |
2122
| | - `label`_ |
2223
| | - `label_attr`_ |
2324
| | - `label_format`_ |
@@ -124,6 +125,8 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
124125

125126
.. include:: /reference/forms/types/options/error_mapping.rst.inc
126127

128+
.. include:: /reference/forms/types/options/help.rst.inc
129+
127130
.. include:: /reference/forms/types/options/label.rst.inc
128131

129132
.. include:: /reference/forms/types/options/label_attr.rst.inc

reference/forms/types/form.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ on all types for which ``FormType`` is the parent.
1919
| | - `error_bubbling`_ |
2020
| | - `error_mapping`_ |
2121
| | - `extra_fields_message`_ |
22+
| | - `help`_ |
2223
| | - `inherit_data`_ |
2324
| | - `invalid_message`_ |
2425
| | - `invalid_message_parameters`_ |
@@ -98,6 +99,8 @@ The actual default value of this option depends on other field options:
9899

99100
.. include:: /reference/forms/types/options/extra_fields_message.rst.inc
100101

102+
.. include:: /reference/forms/types/options/help.rst.inc
103+
101104
.. include:: /reference/forms/types/options/inherit_data.rst.inc
102105

103106
.. include:: /reference/forms/types/options/invalid_message.rst.inc

reference/forms/types/integer.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ integers. By default, all non-integer values (e.g. 6.78) will round down
2828
| | - `empty_data`_ |
2929
| | - `error_bubbling`_ |
3030
| | - `error_mapping`_ |
31+
| | - `help`_ |
3132
| | - `invalid_message`_ |
3233
| | - `invalid_message_parameters`_ |
3334
| | - `label`_ |
@@ -103,6 +104,8 @@ The default value is ``''`` (the empty string).
103104

104105
.. include:: /reference/forms/types/options/error_mapping.rst.inc
105106

107+
.. include:: /reference/forms/types/options/help.rst.inc
108+
106109
.. include:: /reference/forms/types/options/invalid_message.rst.inc
107110

108111
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc

reference/forms/types/language.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ manually, but then you should just use the ``ChoiceType`` directly.
4040
| | - `data`_ |
4141
| | - `disabled`_ |
4242
| | - `empty_data`_ |
43+
| | - `help`_ |
4344
| | - `label`_ |
4445
| | - `label_attr`_ |
4546
| | - `label_format`_ |
@@ -102,6 +103,8 @@ The actual default value of this option depends on other field options:
102103
.. include:: /reference/forms/types/options/empty_data.rst.inc
103104
:start-after: DEFAULT_PLACEHOLDER
104105

106+
.. include:: /reference/forms/types/options/help.rst.inc
107+
105108
.. include:: /reference/forms/types/options/label.rst.inc
106109

107110
.. include:: /reference/forms/types/options/label_attr.rst.inc

0 commit comments

Comments
 (0)