Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9068288

Browse files
author
Dorian Sarnowski
committed
[symfony#2362] Documentation for label_attr option in Form Compontent
1 parent7c038bf commit9068288

26 files changed

+98
-0
lines changed

‎reference/forms/types/button.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ A simple, non-responsive button.
1515
| Options| - `attr`_|
1616
|| - `disabled`_|
1717
|| - `label`_|
18+
|| - `label_attr`_|
1819
|| - `translation_domain`_|
1920
+----------------------+----------------------------------------------------------------------+
2021
| Parent type| none|
@@ -31,4 +32,6 @@ Options
3132

3233
..include::/reference/forms/types/options/button_label.rst.inc
3334

35+
..include::/reference/forms/types/options/label_attr.rst.inc
36+
3437
..include::/reference/forms/types/options/button_translation_domain.rst.inc

‎reference/forms/types/checkbox.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ if the box is unchecked, the value will be set to false.
1616
| Inherited| - `data`_|
1717
| options| - `required`_|
1818
|| - `label`_|
19+
|| - `label_attr`_|
1920
|| - `read_only`_|
2021
|| - `disabled`_|
2122
|| - `error_bubbling`_|
@@ -63,6 +64,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
6364

6465
..include::/reference/forms/types/options/label.rst.inc
6566

67+
..include::/reference/forms/types/options/label_attr.rst.inc
68+
6669
..include::/reference/forms/types/options/read_only.rst.inc
6770

6871
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/choice.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ option.
2222
+-------------+------------------------------------------------------------------------------+
2323
| Inherited| - `required`_|
2424
| options| - `label`_|
25+
|| - `label_attr`_|
2526
|| - `read_only`_|
2627
|| - `disabled`_|
2728
|| - `error_bubbling`_|
@@ -116,6 +117,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
116117

117118
..include::/reference/forms/types/options/label.rst.inc
118119

120+
..include::/reference/forms/types/options/label_attr.rst.inc
121+
119122
..include::/reference/forms/types/options/read_only.rst.inc
120123

121124
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/collection.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ forms, which is useful when creating forms that expose one-to-many relationships
2121
|| - `prototype_name`_|
2222
+-------------+-----------------------------------------------------------------------------+
2323
| Inherited| - `label`_|
24+
|| - `label_attr`_|
2425
| options| - `error_bubbling`_|
2526
|| - `error_mapping`_|
2627
|| - `by_reference`_|
@@ -341,6 +342,8 @@ Not all options are listed here - only the most applicable to this type:
341342

342343
..include::/reference/forms/types/options/label.rst.inc
343344

345+
..include::/reference/forms/types/options/label_attr.rst.inc
346+
344347
..include::/reference/forms/types/options/mapped.rst.inc
345348

346349
..include::/reference/forms/types/options/error_mapping.rst.inc

‎reference/forms/types/country.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ you should just use the ``choice`` type directly.
3333
|| - `error_mapping`_|
3434
|| - `required`_|
3535
|| - `label`_|
36+
|| - `label_attr`_|
3637
|| - `read_only`_|
3738
|| - `disabled`_|
3839
|| - `mapped`_|
@@ -76,6 +77,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
7677

7778
..include::/reference/forms/types/options/label.rst.inc
7879

80+
..include::/reference/forms/types/options/label_attr.rst.inc
81+
7982
..include::/reference/forms/types/options/read_only.rst.inc
8083

8184
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/currency.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ should just use the ``choice`` type directly.
2626
|| - `error_bubbling`_|
2727
|| - `required`_|
2828
|| - `label`_|
29+
|| - `label_attr`_|
2930
|| - `read_only`_|
3031
|| - `disabled`_|
3132
|| - `mapped`_|
@@ -66,6 +67,8 @@ These options inherit from the :doc:`date</reference/forms/types/form>` type:
6667

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

70+
..include::/reference/forms/types/options/label_attr.rst.inc
71+
6972
..include::/reference/forms/types/options/read_only.rst.inc
7073

7174
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/email.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The ``email`` field is a text field that is rendered using the HTML5
1313
| Inherited| - `max_length`_|
1414
| options| - `required`_|
1515
|| - `label`_|
16+
|| - `label_attr`_|
1617
|| - `trim`_|
1718
|| - `read_only`_|
1819
|| - `disabled`_|
@@ -36,6 +37,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
3637

3738
..include::/reference/forms/types/options/label.rst.inc
3839

40+
..include::/reference/forms/types/options/label_attr.rst.inc
41+
3942
..include::/reference/forms/types/options/trim.rst.inc
4043

4144
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/entity.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ objects from the database.
2323
+-------------+------------------------------------------------------------------+
2424
| Inherited| - `required`_|
2525
| options| - `label`_|
26+
|| - `label_attr`_|
2627
|| - `multiple`_|
2728
|| - `expanded`_|
2829
|| - `preferred_choices`_|
@@ -190,6 +191,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
190191

191192
..include::/reference/forms/types/options/label.rst.inc
192193

194+
..include::/reference/forms/types/options/label_attr.rst.inc
195+
193196
..include::/reference/forms/types/options/read_only.rst.inc
194197

195198
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/file.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The ``file`` type represents a file input in your form.
1111
+-------------+---------------------------------------------------------------------+
1212
| Inherited| - `required`_|
1313
| options| - `label`_|
14+
|| - `label_attr`_|
1415
|| - `read_only`_|
1516
|| - `disabled`_|
1617
|| - `error_bubbling`_|
@@ -85,6 +86,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
8586

8687
..include::/reference/forms/types/options/label.rst.inc
8788

89+
..include::/reference/forms/types/options/label_attr.rst.inc
90+
8891
..include::/reference/forms/types/options/read_only.rst.inc
8992

9093
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/form.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on all fields.
1313

1414
..include::/reference/forms/types/options/required.rst.inc
1515

16+
..include::/reference/forms/types/options/label.rst.inc
17+
18+
..include::/reference/forms/types/options/label_attr.rst.inc
19+
1620
..include::/reference/forms/types/options/constraints.rst.inc
1721

1822
..include::/reference/forms/types/options/cascade_validation.rst.inc

‎reference/forms/types/integer.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ integers. By default, all non-integer values (e.g. 6.78) will round down (e.g. 6
2121
+-------------+-----------------------------------------------------------------------+
2222
| Inherited| - `required`_|
2323
| options| - `label`_|
24+
|| - `label_attr`_|
2425
|| - `read_only`_|
2526
|| - `disabled`_|
2627
|| - `error_bubbling`_|
@@ -71,6 +72,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
7172

7273
..include::/reference/forms/types/options/label.rst.inc
7374

75+
..include::/reference/forms/types/options/label_attr.rst.inc
76+
7477
..include::/reference/forms/types/options/read_only.rst.inc
7578

7679
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/language.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ you should just use the ``choice`` type directly.
3434
|| - `error_mapping`_|
3535
|| - `required`_|
3636
|| - `label`_|
37+
|| - `label_attr`_|
3738
|| - `read_only`_|
3839
|| - `disabled`_|
3940
|| - `mapped`_|
@@ -77,6 +78,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
7778

7879
..include::/reference/forms/types/options/label.rst.inc
7980

81+
..include::/reference/forms/types/options/label_attr.rst.inc
82+
8083
..include::/reference/forms/types/options/read_only.rst.inc
8184

8285
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/locale.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ you should just use the ``choice`` type directly.
3636
|| - `error_mapping`_|
3737
|| - `required`_|
3838
|| - `label`_|
39+
|| - `label_attr`_|
3940
|| - `read_only`_|
4041
|| - `disabled`_|
4142
|| - `mapped`_|
@@ -79,6 +80,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
7980

8081
..include::/reference/forms/types/options/label.rst.inc
8182

83+
..include::/reference/forms/types/options/label_attr.rst.inc
84+
8285
..include::/reference/forms/types/options/read_only.rst.inc
8386

8487
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/money.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ how the input and output of the data is handled.
2121
+-------------+---------------------------------------------------------------------+
2222
| Inherited| - `required`_|
2323
| options| - `label`_|
24+
|| - `label_attr`_|
2425
|| - `read_only`_|
2526
|| - `disabled`_|
2627
|| - `error_bubbling`_|
@@ -89,6 +90,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
8990

9091
..include::/reference/forms/types/options/label.rst.inc
9192

93+
..include::/reference/forms/types/options/label_attr.rst.inc
94+
9295
..include::/reference/forms/types/options/read_only.rst.inc
9396

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

‎reference/forms/types/number.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ you want to use for your number.
1717
+-------------+----------------------------------------------------------------------+
1818
| Inherited| - `required`_|
1919
| options| - `label`_|
20+
|| - `label_attr`_|
2021
|| - `read_only`_|
2122
|| - `disabled`_|
2223
|| - `error_bubbling`_|
@@ -79,6 +80,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
7980

8081
..include::/reference/forms/types/options/label.rst.inc
8182

83+
..include::/reference/forms/types/options/label_attr.rst.inc
84+
8285
..include::/reference/forms/types/options/read_only.rst.inc
8386

8487
..include::/reference/forms/types/options/disabled.rst.inc
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
label_attr
2+
~~~~~
3+
4+
**type**: ``array`` **default**: ``array()``
5+
6+
Sets the html attributes for the ``<label>`` element, which will be used when
7+
rendering the label for the field. It's an associative array with HTML attribute
8+
as a key. This attributes can also be directly set inside the template:
9+
10+
.. configuration-block::
11+
12+
.. code-block:: jinja
13+
14+
{{ form_label(form.name, 'Your name', {'label_attr': {'class': 'CUSTOM_LABEL_CLASS'}}) }}
15+
16+
.. code-block:: php
17+
18+
echo $view['form']->label(
19+
$form['name'],
20+
'Your name',
21+
array('class', 'CUSTOM_LABEL_CLASS')
22+
);

‎reference/forms/types/password.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The ``password`` field renders an input password text box.
1414
| Inherited| - `max_length`_|
1515
| options| - `required`_|
1616
|| - `label`_|
17+
|| - `label_attr`_|
1718
|| - `trim`_|
1819
|| - `read_only`_|
1920
|| - `disabled`_|
@@ -52,6 +53,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
5253

5354
..include::/reference/forms/types/options/label.rst.inc
5455

56+
..include::/reference/forms/types/options/label_attr.rst.inc
57+
5558
..include::/reference/forms/types/options/trim.rst.inc
5659

5760
..include::/reference/forms/types/options/read_only.rst.inc

‎reference/forms/types/percent.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This field adds a percentage sign "``%``" after the input box.
2020
+-------------+-----------------------------------------------------------------------+
2121
| Inherited| - `required`_|
2222
| options| - `label`_|
23+
|| - `label_attr`_|
2324
|| - `read_only`_|
2425
|| - `disabled`_|
2526
|| - `error_bubbling`_|
@@ -73,6 +74,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
7374

7475
..include::/reference/forms/types/options/label.rst.inc
7576

77+
..include::/reference/forms/types/options/label_attr.rst.inc
78+
7679
..include::/reference/forms/types/options/read_only.rst.inc
7780

7881
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/radio.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ If you want to have a Boolean field, use :doc:`checkbox </reference/forms/types/
2020
| Inherited| - `data`_|
2121
| options| - `required`_|
2222
|| - `label`_|
23+
|| - `label_attr`_|
2324
|| - `read_only`_|
2425
|| - `disabled`_|
2526
|| - `error_bubbling`_|
@@ -57,6 +58,8 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
5758

5859
..include::/reference/forms/types/options/label.rst.inc
5960

61+
..include::/reference/forms/types/options/label_attr.rst.inc
62+
6063
..include::/reference/forms/types/options/read_only.rst.inc
6164

6265
..include::/reference/forms/types/options/disabled.rst.inc

‎reference/forms/types/reset.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ A button that resets all fields to their original values.
1515
| Inherited| - `attr`_|
1616
| options| - `disabled`_|
1717
|| - `label`_|
18+
|| - `label_attr`_|
1819
|| - `translation_domain`_|
1920
+----------------------+---------------------------------------------------------------------+
2021
| Parent type|:doc:`button</reference/forms/types/button>`|
@@ -31,4 +32,6 @@ Inherited options
3132

3233
..include::/reference/forms/types/options/button_label.rst.inc
3334

35+
..include::/reference/forms/types/options/label_attr.rst.inc
36+
3437
..include::/reference/forms/types/options/button_translation_domain.rst.inc

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp